1136
1136
Session *session= YYSession;
1137
1137
LEX *lex= session->lex;
1138
1138
lex->sql_command= SQLCOM_CREATE_TABLE;
1139
lex->statement= new(std::nothrow) statement::CreateTable(YYSession);
1139
statement::CreateTable *statement= new(std::nothrow) statement::CreateTable(YYSession);
1140
lex->statement= statement;
1140
1141
if (lex->statement == NULL)
1141
1142
DRIZZLE_YYABORT;
1142
1143
if (!lex->select_lex.add_table_to_list(session, $5, NULL,
1143
1144
TL_OPTION_UPDATING,
1145
1146
DRIZZLE_YYABORT;
1146
lex->alter_info.reset();
1147
1147
lex->col_list.empty();
1149
memset(&lex->create_info, 0, sizeof(lex->create_info));
1150
lex->create_info.options=$2 | $4;
1151
lex->create_info.db_type= ha_default_storage_engine(session);
1152
lex->create_info.default_table_charset= NULL;
1148
statement->change=NULL;
1149
statement->create_info.options=$2 | $4;
1150
statement->create_info.db_type= ha_default_storage_engine(session);
1151
statement->create_info.default_table_charset= NULL;
1153
1152
lex->name.str= 0;
1155
message::Table *proto=
1156
lex->create_table_proto= new(std::nothrow) message::Table();
1158
if (lex->create_table_proto == NULL)
1154
message::Table *proto= &statement->create_table_proto;
1161
1156
proto->set_name($5->table.str);
1162
1157
if($2 & HA_LEX_CREATE_TMP_TABLE)
1177
1172
LEX *lex= YYSession->lex;
1173
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1178
1174
lex->current_select= &lex->select_lex;
1179
assert(lex->create_info.db_type);
1175
assert(statement->create_info.db_type);
1181
| CREATE build_method opt_unique INDEX_SYM ident key_alg
1177
| CREATE build_method
1185
1180
lex->sql_command= SQLCOM_CREATE_INDEX;
1186
lex->statement= new(std::nothrow)
1187
statement::CreateIndex(YYSession);
1181
statement::CreateIndex *statement= new(std::nothrow) statement::CreateIndex(YYSession);
1182
lex->statement= statement;
1188
1183
if (lex->statement == NULL)
1189
1184
DRIZZLE_YYABORT;
1190
if (!lex->current_select->add_table_to_list(lex->session, $8,
1185
statement->alter_info.flags.set(ALTER_ADD_INDEX);
1186
statement->alter_info.build_method= $2;
1187
lex->col_list.empty();
1188
statement->change=NULL;
1190
opt_unique INDEX_SYM ident key_alg ON table_ident '(' key_list ')' key_options
1193
statement::CreateIndex *statement= (statement::CreateIndex *)Lex->statement;
1195
if (!lex->current_select->add_table_to_list(lex->session, $9,
1192
1197
TL_OPTION_UPDATING))
1193
1198
DRIZZLE_YYABORT;
1194
lex->alter_info.reset();
1195
lex->alter_info.flags.set(ALTER_ADD_INDEX);
1196
lex->alter_info.build_method= $2;
1197
lex->col_list.empty();
1200
lex->create_table_proto= new message::Table();
1202
'(' key_list ')' key_options
1206
key= new Key($3, $5, &lex->key_create_info, 0,
1208
lex->alter_info.key_list.push_back(key);
1200
key= new Key($4, $6, &statement->key_create_info, 0, lex->col_list);
1201
statement->alter_info.key_list.push_back(key);
1209
1202
lex->col_list.empty();
1211
1204
| CREATE DATABASE opt_if_not_exists ident
1213
Lex->create_info.default_table_charset= NULL;
1214
Lex->create_info.used_fields= 0;
1208
lex->sql_command=SQLCOM_CREATE_DB;
1209
statement::CreateSchema *statement= new(std::nothrow) statement::CreateSchema(YYSession);
1210
lex->statement= statement;
1211
if (lex->statement == NULL)
1213
statement->create_info.options=$3;
1216
1215
opt_create_database_options
1219
lex->sql_command=SQLCOM_CREATE_DB;
1220
lex->statement= new(std::nothrow) statement::CreateSchema(YYSession);
1221
if (lex->statement == NULL)
1224
lex->create_info.options=$3;
1380
1368
| BLOCK_SIZE_SYM opt_equal ulong_num
1382
1370
message::Table::TableOptions *tableopts;
1383
tableopts= Lex->create_table_proto->mutable_options();
1371
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1372
tableopts= ((statement::CreateTable *)Lex->statement)->create_table_proto.mutable_options();
1385
1374
tableopts->set_block_size($3);
1386
Lex->create_info.used_fields|= HA_CREATE_USED_BLOCK_SIZE;
1375
statement->create_info.used_fields|= HA_CREATE_USED_BLOCK_SIZE;
1388
1377
| COMMENT_SYM opt_equal TEXT_STRING_sys
1390
1379
message::Table::TableOptions *tableopts;
1391
tableopts= Lex->create_table_proto->mutable_options();
1380
tableopts= ((statement::CreateTable *)Lex->statement)->create_table_proto.mutable_options();
1393
1382
tableopts->set_comment($3.str);
1395
1384
| AUTO_INC opt_equal ulonglong_num
1397
Lex->create_info.auto_increment_value=$3;
1398
Lex->create_info.used_fields|= HA_CREATE_USED_AUTO;
1386
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1388
statement->create_info.auto_increment_value=$3;
1389
statement->create_info.used_fields|= HA_CREATE_USED_AUTO;
1400
1391
| ROW_FORMAT_SYM opt_equal row_types
1402
Lex->create_info.row_type= $3;
1403
Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT;
1404
Lex->alter_info.flags.set(ALTER_ROW_FORMAT);
1393
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1395
statement->create_info.row_type= $3;
1396
statement->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT;
1397
statement->alter_info.flags.set(ALTER_ROW_FORMAT);
1406
1399
| default_collation
1407
1400
| KEY_BLOCK_SIZE opt_equal ulong_num
1409
Lex->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
1410
Lex->create_info.key_block_size= $3;
1402
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1404
statement->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
1405
statement->create_info.key_block_size= $3;
1414
1409
default_collation:
1415
1410
opt_default COLLATE_SYM opt_equal collation_name_or_default
1417
HA_CREATE_INFO *cinfo= &Lex->create_info;
1412
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1414
HA_CREATE_INFO *cinfo= &statement->create_info;
1418
1415
if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
1419
1416
cinfo->default_table_charset && $4 &&
1420
1417
!my_charset_same(cinfo->default_table_charset,$4))
1501
1508
key_type opt_ident key_alg '(' key_list ')' key_options
1504
Key *key= new Key($1, $2, &lex->key_create_info, 0,
1511
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1512
Key *key= new Key($1, $2, &statement->key_create_info, 0,
1505
1513
lex->col_list);
1506
lex->alter_info.key_list.push_back(key);
1514
statement->alter_info.key_list.push_back(key);
1507
1515
lex->col_list.empty(); /* Alloced by sql_alloc */
1509
1517
| opt_constraint constraint_key_type opt_ident key_alg
1510
1518
'(' key_list ')' key_options
1513
Key *key= new Key($2, $3.str ? $3 : $1, &lex->key_create_info, 0,
1521
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1522
Key *key= new Key($2, $3.str ? $3 : $1, &statement->key_create_info, 0,
1514
1523
lex->col_list);
1515
lex->alter_info.key_list.push_back(key);
1524
statement->alter_info.key_list.push_back(key);
1516
1525
lex->col_list.empty(); /* Alloced by sql_alloc */
1518
1527
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
1530
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1521
1531
Key *key= new Foreign_key($4.str ? $4 : $1, lex->col_list,
1526
lex->fk_match_option);
1527
lex->alter_info.key_list.push_back(key);
1534
statement->fk_delete_opt,
1535
statement->fk_update_opt,
1536
statement->fk_match_option);
1537
statement->alter_info.key_list.push_back(key);
1528
1538
key= new Key(Key::MULTIPLE, $1.str ? $1 : $4,
1529
1539
&default_key_create_info, 1,
1530
1540
lex->col_list);
1531
lex->alter_info.key_list.push_back(key);
1541
statement->alter_info.key_list.push_back(key);
1532
1542
lex->col_list.empty(); /* Alloced by sql_alloc */
1533
1543
/* Only used for ALTER TABLE. Ignored otherwise. */
1534
lex->alter_info.flags.set(ALTER_FOREIGN_KEY);
1544
statement->alter_info.flags.set(ALTER_FOREIGN_KEY);
1536
1546
| constraint opt_check_constraint
1578
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1568
1579
lex->length=lex->dec=0;
1570
lex->default_value= lex->on_update_value= 0;
1571
lex->comment=null_lex_str;
1581
statement->default_value= statement->on_update_value= 0;
1582
statement->comment= null_lex_str;
1572
1583
lex->charset=NULL;
1573
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
1584
statement->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
1589
statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1578
1590
if (add_field_to_list(lex->session, &$1, (enum enum_field_types) $3,
1579
1591
lex->length,lex->dec,lex->type,
1581
lex->default_value, lex->on_update_value,
1583
lex->change,&lex->interval_list,lex->charset))
1592
statement->column_format,
1593
statement->default_value, statement->on_update_value,
1594
&statement->comment,
1595
statement->change, &lex->interval_list, lex->charset))
1584
1596
DRIZZLE_YYABORT;
1717
1729
NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; }
1718
1730
| COLUMN_FORMAT_SYM column_format_types
1720
Lex->column_format= $2;
1721
Lex->alter_info.flags.set(ALTER_COLUMN_FORMAT);
1732
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1734
statement->column_format= $2;
1735
statement->alter_info.flags.set(ALTER_COLUMN_FORMAT);
1723
1737
| not NULL_SYM { Lex->type|= NOT_NULL_FLAG; }
1724
1738
| DEFAULT now_or_signed_literal
1726
Lex->default_value=$2;
1727
Lex->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
1740
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1742
statement->default_value=$2;
1743
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
1729
1745
| ON UPDATE_SYM NOW_SYM optional_braces
1730
{ Lex->on_update_value= new Item_func_now_local(); }
1746
{ ((statement::AlterTable *)Lex->statement)->on_update_value= new Item_func_now_local(); }
1731
1747
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
1732
1748
| SERIAL_SYM DEFAULT VALUE_SYM
1751
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1735
1753
lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG;
1736
lex->alter_info.flags.set(ALTER_ADD_INDEX);
1754
statement->alter_info.flags.set(ALTER_ADD_INDEX);
1738
1756
| opt_primary KEY_SYM
1759
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1741
1761
lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG;
1742
lex->alter_info.flags.set(ALTER_ADD_INDEX);
1762
statement->alter_info.flags.set(ALTER_ADD_INDEX);
1767
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1747
1769
lex->type|= UNIQUE_FLAG;
1748
lex->alter_info.flags.set(ALTER_ADD_INDEX);
1770
statement->alter_info.flags.set(ALTER_ADD_INDEX);
1750
1772
| UNIQUE_SYM KEY_SYM
1775
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1753
1777
lex->type|= UNIQUE_KEY_FLAG;
1754
lex->alter_info.flags.set(ALTER_ADD_INDEX);
1778
statement->alter_info.flags.set(ALTER_ADD_INDEX);
1756
| COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; }
1780
| COMMENT_SYM TEXT_STRING_sys { ((statement::AlterTable *)Lex->statement)->comment= $2; }
1757
1781
| COLLATE_SYM collation_name
1759
1783
if (Lex->charset && !my_charset_same(Lex->charset,$2))
1907
1931
opt_match_clause:
1909
{ Lex->fk_match_option= Foreign_key::FK_MATCH_UNDEF; }
1933
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= Foreign_key::FK_MATCH_UNDEF; }
1911
{ Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; }
1935
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= Foreign_key::FK_MATCH_FULL; }
1912
1936
| MATCH PARTIAL
1913
{ Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; }
1937
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; }
1914
1938
| MATCH SIMPLE_SYM
1915
{ Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; }
1939
{ ((statement::CreateTable *)Lex->statement)->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; }
1918
1942
opt_on_update_delete:
1922
lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF;
1923
lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF;
1945
((statement::CreateTable *)Lex->statement)->fk_update_opt= Foreign_key::FK_OPTION_UNDEF;
1946
((statement::CreateTable *)Lex->statement)->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF;
1925
1948
| ON UPDATE_SYM delete_option
1928
lex->fk_update_opt= $3;
1929
lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF;
1950
((statement::CreateTable *)Lex->statement)->fk_update_opt= $3;
1951
((statement::CreateTable *)Lex->statement)->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF;
1931
1953
| ON DELETE_SYM delete_option
1934
lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF;
1935
lex->fk_delete_opt= $3;
1955
((statement::CreateTable *)Lex->statement)->fk_update_opt= Foreign_key::FK_OPTION_UNDEF;
1956
((statement::CreateTable *)Lex->statement)->fk_delete_opt= $3;
1937
1958
| ON UPDATE_SYM delete_option
1938
1959
ON DELETE_SYM delete_option
1941
lex->fk_update_opt= $3;
1942
lex->fk_delete_opt= $6;
1961
((statement::CreateTable *)Lex->statement)->fk_update_opt= $3;
1962
((statement::CreateTable *)Lex->statement)->fk_delete_opt= $6;
1944
1964
| ON DELETE_SYM delete_option
1945
1965
ON UPDATE_SYM delete_option
1948
lex->fk_update_opt= $6;
1949
lex->fk_delete_opt= $3;
1967
((statement::CreateTable *)Lex->statement)->fk_update_opt= $6;
1968
((statement::CreateTable *)Lex->statement)->fk_delete_opt= $3;
2077
2096
lex->name.str= 0;
2078
2097
lex->name.length= 0;
2079
2098
lex->sql_command= SQLCOM_ALTER_TABLE;
2080
lex->statement= new(std::nothrow) statement::AlterTable(YYSession);
2099
statement::AlterTable *statement= new(std::nothrow) statement::AlterTable(YYSession);
2100
lex->statement= statement;
2081
2101
if (lex->statement == NULL)
2082
2102
DRIZZLE_YYABORT;
2083
2103
lex->duplicates= DUP_ERROR;
2084
2104
if (!lex->select_lex.add_table_to_list(session, $5, NULL,
2085
2105
TL_OPTION_UPDATING))
2086
2106
DRIZZLE_YYABORT;
2087
lex->alter_info.reset();
2088
2107
lex->col_list.empty();
2089
2108
lex->select_lex.init_order();
2090
2109
lex->select_lex.db=
2091
2110
((TableList*) lex->select_lex.table_list.first)->db;
2092
memset(&lex->create_info, 0, sizeof(lex->create_info));
2093
lex->create_info.db_type= 0;
2094
lex->create_info.default_table_charset= NULL;
2095
lex->create_info.row_type= ROW_TYPE_NOT_USED;
2096
lex->alter_info.reset();
2097
lex->alter_info.build_method= $2;
2099
lex->create_table_proto= new message::Table();
2111
statement->create_info.db_type= 0;
2112
statement->create_info.default_table_charset= NULL;
2113
statement->create_info.row_type= ROW_TYPE_NOT_USED;
2114
statement->alter_info.build_method= $2;
2103
2118
| ALTER DATABASE ident_or_empty
2105
Lex->create_info.default_table_charset= NULL;
2106
Lex->create_info.used_fields= 0;
2108
create_database_options
2111
2121
lex->sql_command=SQLCOM_ALTER_DB;
2112
2122
lex->statement= new(std::nothrow) statement::AlterSchema(YYSession);
2113
2123
if (lex->statement == NULL)
2114
2124
DRIZZLE_YYABORT;
2126
default_collation_schema
2116
2130
if (lex->name.str == NULL &&
2117
2131
lex->copy_db_to(&lex->name.str, &lex->name.length))
2164
2187
add_column column_def opt_place { }
2167
Lex->alter_info.flags.set(ALTER_ADD_INDEX);
2190
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2192
statement->alter_info.flags.set(ALTER_ADD_INDEX);
2169
2194
| add_column '(' field_list ')'
2171
Lex->alter_info.flags.set(ALTER_ADD_COLUMN);
2172
Lex->alter_info.flags.set(ALTER_ADD_INDEX);
2196
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2198
statement->alter_info.flags.set(ALTER_ADD_COLUMN);
2199
statement->alter_info.flags.set(ALTER_ADD_INDEX);
2174
2201
| CHANGE opt_column field_ident
2177
lex->change= $3.str;
2178
lex->alter_info.flags.set(ALTER_CHANGE_COLUMN);
2203
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2204
statement->change= $3.str;
2205
statement->alter_info.flags.set(ALTER_CHANGE_COLUMN);
2180
2207
field_spec opt_place
2181
2208
| MODIFY_SYM opt_column field_ident
2211
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2184
2212
lex->length=lex->dec=0; lex->type=0;
2185
lex->default_value= lex->on_update_value= 0;
2186
lex->comment=null_lex_str;
2213
statement->default_value= statement->on_update_value= 0;
2214
statement->comment= null_lex_str;
2187
2215
lex->charset= NULL;
2188
lex->alter_info.flags.set(ALTER_CHANGE_COLUMN);
2189
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
2216
statement->alter_info.flags.set(ALTER_CHANGE_COLUMN);
2217
statement->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
2222
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2194
2224
if (add_field_to_list(lex->session,&$3,
2195
2225
(enum enum_field_types) $5,
2196
lex->length,lex->dec,lex->type,
2198
lex->default_value, lex->on_update_value,
2226
lex->length, lex->dec, lex->type,
2227
statement->column_format,
2228
statement->default_value,
2229
statement->on_update_value,
2230
&statement->comment,
2200
2231
$3.str, &lex->interval_list, lex->charset))
2201
2232
DRIZZLE_YYABORT;
2204
2235
| DROP opt_column field_ident
2207
lex->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::COLUMN,
2209
lex->alter_info.flags.set(ALTER_DROP_COLUMN);
2237
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2239
statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::COLUMN, $3.str));
2240
statement->alter_info.flags.set(ALTER_DROP_COLUMN);
2211
2242
| DROP FOREIGN KEY_SYM opt_ident
2213
Lex->alter_info.flags.set(ALTER_DROP_INDEX);
2214
Lex->alter_info.flags.set(ALTER_FOREIGN_KEY);
2244
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2246
statement->alter_info.flags.set(ALTER_DROP_INDEX);
2247
statement->alter_info.flags.set(ALTER_FOREIGN_KEY);
2216
2249
| DROP PRIMARY_SYM KEY_SYM
2219
lex->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
2251
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2253
statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
2221
lex->alter_info.flags.set(ALTER_DROP_INDEX);
2255
statement->alter_info.flags.set(ALTER_DROP_INDEX);
2223
2257
| DROP key_or_index field_ident
2226
lex->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
2228
lex->alter_info.flags.set(ALTER_DROP_INDEX);
2259
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2261
statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
2263
statement->alter_info.flags.set(ALTER_DROP_INDEX);
2230
2265
| DISABLE_SYM KEYS
2233
lex->alter_info.keys_onoff= DISABLE;
2234
lex->alter_info.flags.set(ALTER_KEYS_ONOFF);
2267
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2269
statement->alter_info.keys_onoff= DISABLE;
2270
statement->alter_info.flags.set(ALTER_KEYS_ONOFF);
2236
2272
| ENABLE_SYM KEYS
2239
lex->alter_info.keys_onoff= ENABLE;
2240
lex->alter_info.flags.set(ALTER_KEYS_ONOFF);
2274
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2276
statement->alter_info.keys_onoff= ENABLE;
2277
statement->alter_info.flags.set(ALTER_KEYS_ONOFF);
2242
2279
| ALTER opt_column field_ident SET DEFAULT signed_literal
2245
lex->alter_info.alter_list.push_back(new AlterColumn($3.str,$6));
2246
lex->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
2281
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2283
statement->alter_info.alter_list.push_back(new AlterColumn($3.str,$6));
2284
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
2248
2286
| ALTER opt_column field_ident DROP DEFAULT
2251
lex->alter_info.alter_list.push_back(new AlterColumn($3.str,
2253
lex->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
2288
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2290
statement->alter_info.alter_list.push_back(new AlterColumn($3.str, (Item*) 0));
2291
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT);
2255
2293
| RENAME opt_to table_ident
2296
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2259
2299
lex->select_lex.db=$3->db.str;
2260
2300
if (lex->select_lex.db == NULL &&
2261
2301
lex->copy_db_to(&lex->select_lex.db, &dummy))
2268
2308
DRIZZLE_YYABORT;
2270
2310
lex->name= $3->table;
2271
lex->alter_info.flags.set(ALTER_RENAME);
2311
statement->alter_info.flags.set(ALTER_RENAME);
2273
2313
| CONVERT_SYM TO_SYM collation_name_or_default
2276
lex->create_info.table_charset=
2277
lex->create_info.default_table_charset= $3;
2278
lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
2315
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2317
statement->create_info.table_charset=
2318
statement->create_info.default_table_charset= $3;
2319
statement->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
2279
2320
HA_CREATE_USED_DEFAULT_CHARSET);
2280
lex->alter_info.flags.set(ALTER_CONVERT);
2321
statement->alter_info.flags.set(ALTER_CONVERT);
2282
2323
| create_table_options_space_separated
2285
lex->alter_info.flags.set(ALTER_OPTIONS);
2325
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2327
statement->alter_info.flags.set(ALTER_OPTIONS);
2289
Lex->alter_info.flags.set(ALTER_FORCE);
2331
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2333
statement->alter_info.flags.set(ALTER_FORCE);
2291
2335
| alter_order_clause
2294
lex->alter_info.flags.set(ALTER_ORDER);
2337
statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
2339
statement->alter_info.flags.set(ALTER_ORDER);
4335
4381
lex->sql_command = SQLCOM_DROP_TABLE;
4336
lex->statement= new(std::nothrow) statement::DropTable(YYSession);
4382
statement::DropTable *statement= new(std::nothrow) statement::DropTable(YYSession);
4383
lex->statement= statement;
4337
4384
if (lex->statement == NULL)
4338
4385
DRIZZLE_YYABORT;
4339
lex->drop_temporary= $2;
4340
lex->drop_if_exists= $4;
4386
statement->drop_temporary= $2;
4387
statement->drop_if_exists= $4;
4342
4389
| DROP build_method INDEX_SYM ident ON table_ident {}
4345
4392
lex->sql_command= SQLCOM_DROP_INDEX;
4346
lex->statement= new(std::nothrow)
4347
statement::DropIndex(YYSession);
4393
statement::DropIndex *statement= new(std::nothrow) statement::DropIndex(YYSession);
4394
lex->statement= statement;
4348
4395
if (lex->statement == NULL)
4349
4396
DRIZZLE_YYABORT;
4350
lex->alter_info.reset();
4351
lex->alter_info.flags.set(ALTER_DROP_INDEX);
4352
lex->alter_info.build_method= $2;
4353
lex->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
4397
statement->alter_info.flags.set(ALTER_DROP_INDEX);
4398
statement->alter_info.build_method= $2;
4399
statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY, $4.str));
4355
4400
if (!lex->current_select->add_table_to_list(lex->session, $6, NULL,
4356
4401
TL_OPTION_UPDATING))
4357
4402
DRIZZLE_YYABORT;
4359
lex->create_table_proto= new message::Table();
4361
4404
| DROP DATABASE if_exists ident
4364
4407
lex->sql_command= SQLCOM_DROP_DB;
4365
lex->statement= new(std::nothrow) statement::DropSchema(YYSession);
4408
statement::DropSchema *statement= new(std::nothrow) statement::DropSchema(YYSession);
4409
lex->statement= statement;
4366
4410
if (lex->statement == NULL)
4367
4411
DRIZZLE_YYABORT;
4368
lex->drop_if_exists=$3;
4412
statement->drop_if_exists=$3;