1256
1264
CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident
1258
Session *session= YYSession;
1259
LEX *lex= session->lex;
1260
1268
lex->sql_command= SQLCOM_CREATE_TABLE;
1261
if (!lex->select_lex.add_table_to_list(session, $5, NULL,
1269
if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
1262
1270
TL_OPTION_UPDATING,
1264
1272
DRIZZLE_YYABORT;
1265
1273
lex->alter_info.reset();
1266
1274
lex->col_list.empty();
1268
1276
memset(&lex->create_info, 0, sizeof(lex->create_info));
1269
1277
lex->create_info.options=$2 | $4;
1270
lex->create_info.db_type= ha_default_handlerton(session);
1278
lex->create_info.db_type= ha_default_handlerton(thd);
1271
1279
lex->create_info.default_table_charset= NULL;
1272
1280
lex->name.str= 0;
1273
1281
lex->name.length= 0;
1277
LEX *lex= YYSession->lex;
1285
LEX *lex= YYTHD->lex;
1278
1286
lex->current_select= &lex->select_lex;
1279
1287
if (!lex->create_info.db_type)
1281
lex->create_info.db_type= ha_default_handlerton(YYSession);
1282
push_warning_printf(YYSession, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1289
lex->create_info.db_type= ha_default_handlerton(YYTHD);
1290
push_warning_printf(YYTHD, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1283
1291
ER_WARN_USING_OTHER_HANDLER,
1284
1292
ER(ER_WARN_USING_OTHER_HANDLER),
1285
1293
ha_resolve_storage_engine_name(lex->create_info.db_type),
1716
1749
lex->comment=null_lex_str;
1717
1750
lex->charset=NULL;
1718
1751
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
1719
lex->vcol_info= NULL;
1724
if (add_field_to_list(lex->session, &$1, (enum enum_field_types) $3,
1756
if (add_field_to_list(lex->thd, &$1, (enum enum_field_types) $3,
1725
1757
lex->length,lex->dec,lex->type,
1726
1758
lex->column_format,
1727
1759
lex->default_value, lex->on_update_value,
1729
lex->change,&lex->interval_list,lex->charset,
1735
type opt_attribute {}
1736
| VIRTUAL_SYM type AS '(' virtual_column_func ')' vcol_opt_attribute
1738
$$=DRIZZLE_TYPE_VIRTUAL;
1739
Lex->vcol_info->set_field_type((enum enum_field_types) $2);
1745
| vcol_opt_attribute_list {}
1748
vcol_opt_attribute_list:
1749
vcol_opt_attribute_list vcol_attribute {}
1757
lex->type|= UNIQUE_FLAG;
1758
lex->alter_info.flags|= ALTER_ADD_INDEX;
1760
| UNIQUE_SYM KEY_SYM
1763
lex->type|= UNIQUE_KEY_FLAG;
1764
lex->alter_info.flags|= ALTER_ADD_INDEX;
1766
| COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; }
1769
Lex->vcol_info->set_field_stored(true);
1774
PARSE_VCOL_EXPR_SYM '(' virtual_column_func ')'
1777
"PARSE_VCOL_EXPR" can only be used by the SQL server
1778
when reading a '*.frm' file.
1779
Prevent the end user from invoking this command.
1781
if (not Lex->parse_vcol_expr)
1783
my_message(ER_SYNTAX_ERROR, ER(ER_SYNTAX_ERROR), MYF(0));
1789
virtual_column_func:
1790
remember_name expr remember_end
1792
Lex->vcol_info= new virtual_column_info();
1793
if (not Lex->vcol_info)
1795
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(virtual_column_info));
1798
uint expr_len= (uint)($3 - $1) - 1;
1799
Lex->vcol_info->expr_str.str= (char* ) sql_memdup($1 + 1, expr_len);
1800
Lex->vcol_info->expr_str.length= expr_len;
1801
Lex->vcol_info->expr_item= $2;
1761
lex->change,&lex->interval_list,lex->charset))
1767
int_type field_options
1809
1770
Lex->length=(char*) 0; /* use default length */
1811
| real_type opt_precision { $$=$1; }
1772
| real_type opt_precision field_options { $$=$1; }
1775
Lex->length= (char*) "1";
1776
$$=DRIZZLE_TYPE_TINY;
1780
Lex->length=(char*) "1";
1781
$$=DRIZZLE_TYPE_TINY;
1785
Lex->length=(char*) "1";
1786
$$=DRIZZLE_TYPE_TINY;
1812
1788
| char '(' NUM ')' opt_binary
1814
1790
Lex->length=$3.str;
3131
$$ = new (YYSession->mem_root) Item_cond_and($1, $3);
3221
$$ = new (YYTHD->mem_root) Item_cond_and($1, $3);
3134
3224
| NOT_SYM expr %prec NOT_SYM
3135
{ $$= negate_expression(YYSession, $2); }
3225
{ $$= negate_expression(YYTHD, $2); }
3136
3226
| bool_pri IS TRUE_SYM %prec IS
3137
{ $$= new (YYSession->mem_root) Item_func_istrue($1); }
3227
{ $$= new (YYTHD->mem_root) Item_func_istrue($1); }
3138
3228
| bool_pri IS not TRUE_SYM %prec IS
3139
{ $$= new (YYSession->mem_root) Item_func_isnottrue($1); }
3229
{ $$= new (YYTHD->mem_root) Item_func_isnottrue($1); }
3140
3230
| bool_pri IS FALSE_SYM %prec IS
3141
{ $$= new (YYSession->mem_root) Item_func_isfalse($1); }
3231
{ $$= new (YYTHD->mem_root) Item_func_isfalse($1); }
3142
3232
| bool_pri IS not FALSE_SYM %prec IS
3143
{ $$= new (YYSession->mem_root) Item_func_isnotfalse($1); }
3233
{ $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); }
3144
3234
| bool_pri IS UNKNOWN_SYM %prec IS
3145
3235
{ $$= new Item_func_isnull($1); }
3146
3236
| bool_pri IS not UNKNOWN_SYM %prec IS
3166
3256
bit_expr IN_SYM '(' subselect ')'
3168
$$= new (YYSession->mem_root) Item_in_subselect($1, $4);
3258
$$= new (YYTHD->mem_root) Item_in_subselect($1, $4);
3170
3260
| bit_expr not IN_SYM '(' subselect ')'
3172
Session *session= YYSession;
3173
Item *item= new (session->mem_root) Item_in_subselect($1, $5);
3174
$$= negate_expression(session, item);
3263
Item *item= new (thd->mem_root) Item_in_subselect($1, $5);
3264
$$= negate_expression(thd, item);
3176
3266
| bit_expr IN_SYM '(' expr ')'
3178
$$= handle_sql2003_note184_exception(YYSession, $1, true, $4);
3268
$$= handle_sql2003_note184_exception(YYTHD, $1, true, $4);
3180
3270
| bit_expr IN_SYM '(' expr ',' expr_list ')'
3182
3272
$6->push_front($4);
3183
3273
$6->push_front($1);
3184
$$= new (YYSession->mem_root) Item_func_in(*$6);
3274
$$= new (YYTHD->mem_root) Item_func_in(*$6);
3186
3276
| bit_expr not IN_SYM '(' expr ')'
3188
$$= handle_sql2003_note184_exception(YYSession, $1, false, $5);
3278
$$= handle_sql2003_note184_exception(YYTHD, $1, false, $5);
3190
3280
| bit_expr not IN_SYM '(' expr ',' expr_list ')'
3192
3282
$7->push_front($5);
3193
3283
$7->push_front($1);
3194
Item_func_in *item = new (YYSession->mem_root) Item_func_in(*$7);
3284
Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7);
3195
3285
item->negate();
3266
3356
| function_call_conflict
3267
3357
| simple_expr COLLATE_SYM ident_or_text %prec NEG
3269
Session *session= YYSession;
3270
Item *i1= new (session->mem_root) Item_string($3.str,
3360
Item *i1= new (thd->mem_root) Item_string($3.str,
3272
session->charset());
3273
$$= new (session->mem_root) Item_func_set_collation($1, i1);
3363
$$= new (thd->mem_root) Item_func_set_collation($1, i1);
3278
3368
| '+' simple_expr %prec NEG { $$= $2; }
3279
3369
| '-' simple_expr %prec NEG
3280
{ $$= new (YYSession->mem_root) Item_func_neg($2); }
3370
{ $$= new (YYTHD->mem_root) Item_func_neg($2); }
3281
3371
| '(' subselect ')'
3283
$$= new (YYSession->mem_root) Item_singlerow_subselect($2);
3373
$$= new (YYTHD->mem_root) Item_singlerow_subselect($2);
3285
3375
| '(' expr ')' { $$= $2; }
3286
3376
| '(' expr ',' expr_list ')'
3288
3378
$4->push_front($2);
3289
$$= new (YYSession->mem_root) Item_row(*$4);
3379
$$= new (YYTHD->mem_root) Item_row(*$4);
3291
3381
| ROW_SYM '(' expr ',' expr_list ')'
3293
3383
$5->push_front($3);
3294
$$= new (YYSession->mem_root) Item_row(*$5);
3384
$$= new (YYTHD->mem_root) Item_row(*$5);
3296
3386
| EXISTS '(' subselect ')'
3298
$$= new (YYSession->mem_root) Item_exists_subselect($3);
3388
$$= new (YYTHD->mem_root) Item_exists_subselect($3);
3300
3390
| '{' ident expr '}' { $$= $3; }
3301
3391
| BINARY simple_expr %prec NEG
3303
$$= create_func_cast(YYSession, $2, ITEM_CAST_CHAR, NULL, NULL,
3393
$$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL,
3304
3394
&my_charset_bin);
3306
3396
| CAST_SYM '(' expr AS cast_type ')'
3309
$$= create_func_cast(YYSession, $3, $5, lex->length, lex->dec,
3399
$$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec,
3312
3402
DRIZZLE_YYABORT;
3314
3404
| CASE_SYM opt_expr when_list opt_else END
3315
{ $$= new (YYSession->mem_root) Item_func_case(* $3, $2, $4 ); }
3405
{ $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 ); }
3316
3406
| CONVERT_SYM '(' expr ',' cast_type ')'
3318
$$= create_func_cast(YYSession, $3, $5, Lex->length, Lex->dec,
3408
$$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec,
3321
3411
DRIZZLE_YYABORT;
3413
| CONVERT_SYM '(' expr USING charset_name ')'
3414
{ $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5); }
3323
3415
| DEFAULT '(' simple_ident ')'
3325
$$= new (YYSession->mem_root) Item_default_value(Lex->current_context(),
3417
$$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(),
3328
3420
| VALUES '(' simple_ident_nospvar ')'
3330
$$= new (YYSession->mem_root) Item_insert_value(Lex->current_context(),
3422
$$= new (YYTHD->mem_root) Item_insert_value(Lex->current_context(),
3333
3425
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
3334
3426
/* we cannot put interval before - */
3335
{ $$= new (YYSession->mem_root) Item_date_add_interval($5,$2,$3,0); }
3427
{ $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0); }
3344
3436
function_call_keyword:
3345
3437
CHAR_SYM '(' expr_list ')'
3346
{ $$= new (YYSession->mem_root) Item_func_char(*$3); }
3438
{ $$= new (YYTHD->mem_root) Item_func_char(*$3); }
3439
| CHAR_SYM '(' expr_list USING charset_name ')'
3440
{ $$= new (YYTHD->mem_root) Item_func_char(*$3, $5); }
3347
3441
| CURRENT_USER optional_braces
3349
$$= new (YYSession->mem_root) Item_func_current_user(Lex->current_context());
3443
$$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
3350
3444
Lex->set_stmt_unsafe();
3352
3446
| DATE_SYM '(' expr ')'
3353
{ $$= new (YYSession->mem_root) Item_date_typecast($3); }
3447
{ $$= new (YYTHD->mem_root) Item_date_typecast($3); }
3354
3448
| DAY_SYM '(' expr ')'
3355
{ $$= new (YYSession->mem_root) Item_func_dayofmonth($3); }
3449
{ $$= new (YYTHD->mem_root) Item_func_dayofmonth($3); }
3356
3450
| HOUR_SYM '(' expr ')'
3357
{ $$= new (YYSession->mem_root) Item_func_hour($3); }
3451
{ $$= new (YYTHD->mem_root) Item_func_hour($3); }
3358
3452
| INSERT '(' expr ',' expr ',' expr ',' expr ')'
3359
{ $$= new (YYSession->mem_root) Item_func_insert($3,$5,$7,$9); }
3453
{ $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9); }
3360
3454
| INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
3362
Session *session= YYSession;
3363
List<Item> *list= new (session->mem_root) List<Item>;
3457
List<Item> *list= new (thd->mem_root) List<Item>;
3364
3458
list->push_front($5);
3365
3459
list->push_front($3);
3366
Item_row *item= new (session->mem_root) Item_row(*list);
3367
$$= new (session->mem_root) Item_func_interval(item);
3460
Item_row *item= new (thd->mem_root) Item_row(*list);
3461
$$= new (thd->mem_root) Item_func_interval(item);
3369
3463
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
3371
Session *session= YYSession;
3372
3466
$7->push_front($5);
3373
3467
$7->push_front($3);
3374
Item_row *item= new (session->mem_root) Item_row(*$7);
3375
$$= new (session->mem_root) Item_func_interval(item);
3468
Item_row *item= new (thd->mem_root) Item_row(*$7);
3469
$$= new (thd->mem_root) Item_func_interval(item);
3377
3471
| LEFT '(' expr ',' expr ')'
3378
{ $$= new (YYSession->mem_root) Item_func_left($3,$5); }
3472
{ $$= new (YYTHD->mem_root) Item_func_left($3,$5); }
3379
3473
| MINUTE_SYM '(' expr ')'
3380
{ $$= new (YYSession->mem_root) Item_func_minute($3); }
3474
{ $$= new (YYTHD->mem_root) Item_func_minute($3); }
3381
3475
| MONTH_SYM '(' expr ')'
3382
{ $$= new (YYSession->mem_root) Item_func_month($3); }
3476
{ $$= new (YYTHD->mem_root) Item_func_month($3); }
3383
3477
| RIGHT '(' expr ',' expr ')'
3384
{ $$= new (YYSession->mem_root) Item_func_right($3,$5); }
3478
{ $$= new (YYTHD->mem_root) Item_func_right($3,$5); }
3385
3479
| SECOND_SYM '(' expr ')'
3386
{ $$= new (YYSession->mem_root) Item_func_second($3); }
3480
{ $$= new (YYTHD->mem_root) Item_func_second($3); }
3387
3481
| TIME_SYM '(' expr ')'
3388
{ $$= new (YYSession->mem_root) Item_time_typecast($3); }
3482
{ $$= new (YYTHD->mem_root) Item_time_typecast($3); }
3389
3483
| TIMESTAMP '(' expr ')'
3390
{ $$= new (YYSession->mem_root) Item_datetime_typecast($3); }
3484
{ $$= new (YYTHD->mem_root) Item_datetime_typecast($3); }
3391
3485
| TIMESTAMP '(' expr ',' expr ')'
3392
{ $$= new (YYSession->mem_root) Item_func_add_time($3, $5, 1, 0); }
3486
{ $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0); }
3393
3487
| TRIM '(' expr ')'
3394
{ $$= new (YYSession->mem_root) Item_func_trim($3); }
3488
{ $$= new (YYTHD->mem_root) Item_func_trim($3); }
3395
3489
| TRIM '(' LEADING expr FROM expr ')'
3396
{ $$= new (YYSession->mem_root) Item_func_ltrim($6,$4); }
3490
{ $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4); }
3397
3491
| TRIM '(' TRAILING expr FROM expr ')'
3398
{ $$= new (YYSession->mem_root) Item_func_rtrim($6,$4); }
3492
{ $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4); }
3399
3493
| TRIM '(' BOTH expr FROM expr ')'
3400
{ $$= new (YYSession->mem_root) Item_func_trim($6,$4); }
3494
{ $$= new (YYTHD->mem_root) Item_func_trim($6,$4); }
3401
3495
| TRIM '(' LEADING FROM expr ')'
3402
{ $$= new (YYSession->mem_root) Item_func_ltrim($5); }
3496
{ $$= new (YYTHD->mem_root) Item_func_ltrim($5); }
3403
3497
| TRIM '(' TRAILING FROM expr ')'
3404
{ $$= new (YYSession->mem_root) Item_func_rtrim($5); }
3498
{ $$= new (YYTHD->mem_root) Item_func_rtrim($5); }
3405
3499
| TRIM '(' BOTH FROM expr ')'
3406
{ $$= new (YYSession->mem_root) Item_func_trim($5); }
3500
{ $$= new (YYTHD->mem_root) Item_func_trim($5); }
3407
3501
| TRIM '(' expr FROM expr ')'
3408
{ $$= new (YYSession->mem_root) Item_func_trim($5,$3); }
3502
{ $$= new (YYTHD->mem_root) Item_func_trim($5,$3); }
3411
$$= new (YYSession->mem_root) Item_func_user();
3505
$$= new (YYTHD->mem_root) Item_func_user();
3412
3506
Lex->set_stmt_unsafe();
3414
3508
| YEAR_SYM '(' expr ')'
3415
{ $$= new (YYSession->mem_root) Item_func_year($3); }
3509
{ $$= new (YYTHD->mem_root) Item_func_year($3); }
3430
3524
function_call_nonkeyword:
3431
3525
ADDDATE_SYM '(' expr ',' expr ')'
3433
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5,
3527
$$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
3434
3528
INTERVAL_DAY, 0);
3436
3530
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
3437
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 0); }
3531
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0); }
3438
3532
| CURDATE optional_braces
3440
$$= new (YYSession->mem_root) Item_func_curdate_local();
3534
$$= new (YYTHD->mem_root) Item_func_curdate_local();
3442
3536
| CURTIME optional_braces
3444
$$= new (YYSession->mem_root) Item_func_curtime_local();
3538
$$= new (YYTHD->mem_root) Item_func_curtime_local();
3446
3540
| CURTIME '(' expr ')'
3448
$$= new (YYSession->mem_root) Item_func_curtime_local($3);
3542
$$= new (YYTHD->mem_root) Item_func_curtime_local($3);
3450
3544
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
3451
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,0); }
3545
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0); }
3452
3546
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
3453
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,1); }
3547
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,1); }
3454
3548
| EXTRACT_SYM '(' interval FROM expr ')'
3455
{ $$=new (YYSession->mem_root) Item_extract( $3, $5); }
3549
{ $$=new (YYTHD->mem_root) Item_extract( $3, $5); }
3456
3550
| GET_FORMAT '(' date_time_type ',' expr ')'
3457
{ $$= new (YYSession->mem_root) Item_func_get_format($3, $5); }
3551
{ $$= new (YYTHD->mem_root) Item_func_get_format($3, $5); }
3458
3552
| NOW_SYM optional_braces
3460
$$= new (YYSession->mem_root) Item_func_now_local();
3554
$$= new (YYTHD->mem_root) Item_func_now_local();
3462
3556
| NOW_SYM '(' expr ')'
3464
$$= new (YYSession->mem_root) Item_func_now_local($3);
3558
$$= new (YYTHD->mem_root) Item_func_now_local($3);
3466
3560
| POSITION_SYM '(' bit_expr IN_SYM expr ')'
3467
{ $$ = new (YYSession->mem_root) Item_func_locate($5,$3); }
3561
{ $$ = new (YYTHD->mem_root) Item_func_locate($5,$3); }
3468
3562
| SUBDATE_SYM '(' expr ',' expr ')'
3470
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5,
3564
$$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
3471
3565
INTERVAL_DAY, 1);
3473
3567
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
3474
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 1); }
3568
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 1); }
3475
3569
| SUBSTRING '(' expr ',' expr ',' expr ')'
3476
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5,$7); }
3570
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); }
3477
3571
| SUBSTRING '(' expr ',' expr ')'
3478
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5); }
3572
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5); }
3479
3573
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
3480
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5,$7); }
3574
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); }
3481
3575
| SUBSTRING '(' expr FROM expr ')'
3482
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5); }
3576
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5); }
3483
3577
| SYSDATE optional_braces
3485
3579
if (global_system_variables.sysdate_is_now == 0)
3486
$$= new (YYSession->mem_root) Item_func_sysdate_local();
3580
$$= new (YYTHD->mem_root) Item_func_sysdate_local();
3488
$$= new (YYSession->mem_root) Item_func_now_local();
3582
$$= new (YYTHD->mem_root) Item_func_now_local();
3490
3584
| SYSDATE '(' expr ')'
3492
3586
if (global_system_variables.sysdate_is_now == 0)
3493
$$= new (YYSession->mem_root) Item_func_sysdate_local($3);
3587
$$= new (YYTHD->mem_root) Item_func_sysdate_local($3);
3495
$$= new (YYSession->mem_root) Item_func_now_local($3);
3589
$$= new (YYTHD->mem_root) Item_func_now_local($3);
3497
3591
| TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
3498
{ $$= new (YYSession->mem_root) Item_date_add_interval($7,$5,$3,0); }
3592
{ $$= new (YYTHD->mem_root) Item_date_add_interval($7,$5,$3,0); }
3499
3593
| TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
3500
{ $$= new (YYSession->mem_root) Item_func_timestamp_diff($5,$7,$3); }
3594
{ $$= new (YYTHD->mem_root) Item_func_timestamp_diff($5,$7,$3); }
3501
3595
| UTC_DATE_SYM optional_braces
3503
$$= new (YYSession->mem_root) Item_func_curdate_utc();
3597
$$= new (YYTHD->mem_root) Item_func_curdate_utc();
3505
3599
| UTC_TIME_SYM optional_braces
3507
$$= new (YYSession->mem_root) Item_func_curtime_utc();
3601
$$= new (YYTHD->mem_root) Item_func_curtime_utc();
3509
3603
| UTC_TIMESTAMP_SYM optional_braces
3511
$$= new (YYSession->mem_root) Item_func_now_utc();
3605
$$= new (YYTHD->mem_root) Item_func_now_utc();
3520
3614
function_call_conflict:
3521
3615
ASCII_SYM '(' expr ')'
3522
{ $$= new (YYSession->mem_root) Item_func_ascii($3); }
3616
{ $$= new (YYTHD->mem_root) Item_func_ascii($3); }
3617
| CHARSET '(' expr ')'
3618
{ $$= new (YYTHD->mem_root) Item_func_charset($3); }
3523
3619
| COALESCE '(' expr_list ')'
3524
{ $$= new (YYSession->mem_root) Item_func_coalesce(* $3); }
3620
{ $$= new (YYTHD->mem_root) Item_func_coalesce(* $3); }
3525
3621
| COLLATION_SYM '(' expr ')'
3526
{ $$= new (YYSession->mem_root) Item_func_collation($3); }
3622
{ $$= new (YYTHD->mem_root) Item_func_collation($3); }
3527
3623
| DATABASE '(' ')'
3529
$$= new (YYSession->mem_root) Item_func_database();
3625
$$= new (YYTHD->mem_root) Item_func_database();
3531
3627
| IF '(' expr ',' expr ',' expr ')'
3532
{ $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); }
3628
{ $$= new (YYTHD->mem_root) Item_func_if($3,$5,$7); }
3533
3629
| MICROSECOND_SYM '(' expr ')'
3534
{ $$= new (YYSession->mem_root) Item_func_microsecond($3); }
3630
{ $$= new (YYTHD->mem_root) Item_func_microsecond($3); }
3535
3631
| MOD_SYM '(' expr ',' expr ')'
3536
{ $$ = new (YYSession->mem_root) Item_func_mod( $3, $5); }
3632
{ $$ = new (YYTHD->mem_root) Item_func_mod( $3, $5); }
3537
3633
| QUARTER_SYM '(' expr ')'
3538
{ $$ = new (YYSession->mem_root) Item_func_quarter($3); }
3634
{ $$ = new (YYTHD->mem_root) Item_func_quarter($3); }
3539
3635
| REPEAT_SYM '(' expr ',' expr ')'
3540
{ $$= new (YYSession->mem_root) Item_func_repeat($3,$5); }
3636
{ $$= new (YYTHD->mem_root) Item_func_repeat($3,$5); }
3541
3637
| REPLACE '(' expr ',' expr ',' expr ')'
3542
{ $$= new (YYSession->mem_root) Item_func_replace($3,$5,$7); }
3638
{ $$= new (YYTHD->mem_root) Item_func_replace($3,$5,$7); }
3543
3639
| REVERSE_SYM '(' expr ')'
3544
{ $$= new (YYSession->mem_root) Item_func_reverse($3); }
3640
{ $$= new (YYTHD->mem_root) Item_func_reverse($3); }
3545
3641
| TRUNCATE_SYM '(' expr ',' expr ')'
3546
{ $$= new (YYSession->mem_root) Item_func_round($3,$5,1); }
3642
{ $$= new (YYTHD->mem_root) Item_func_round($3,$5,1); }
3547
3643
| WEEK_SYM '(' expr ')'
3549
Session *session= YYSession;
3550
Item *i1= new (session->mem_root) Item_int((char*) "0",
3551
session->variables.default_week_format,
3646
Item *i1= new (thd->mem_root) Item_int((char*) "0",
3647
thd->variables.default_week_format,
3554
$$= new (session->mem_root) Item_func_week($3, i1);
3650
$$= new (thd->mem_root) Item_func_week($3, i1);
3556
3652
| WEEK_SYM '(' expr ',' expr ')'
3557
{ $$= new (YYSession->mem_root) Item_func_week($3,$5); }
3653
{ $$= new (YYTHD->mem_root) Item_func_week($3,$5); }
3558
3654
| WEIGHT_STRING_SYM '(' expr opt_ws_levels ')'
3559
{ $$= new (YYSession->mem_root) Item_func_weight_string($3, 0, $4); }
3655
{ $$= new (YYTHD->mem_root) Item_func_weight_string($3, 0, $4); }
3560
3656
| WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')'
3562
$$= new (YYSession->mem_root)
3658
$$= new (YYTHD->mem_root)
3563
3659
Item_func_weight_string($3, $6, $7|MY_STRXFRM_PAD_WITH_SPACE);
3565
3661
| WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')'
3567
$3= create_func_char_cast(YYSession, $3, $6, &my_charset_bin);
3568
$$= new (YYSession->mem_root)
3663
$3= create_func_char_cast(YYTHD, $3, $6, &my_charset_bin);
3664
$$= new (YYTHD->mem_root)
3569
3665
Item_func_weight_string($3, $6, MY_STRXFRM_PAD_WITH_SPACE);
4488
4606
group_list ',' order_ident order_dir
4489
{ if (add_group_to_list(YYSession, $3,(bool) $4)) DRIZZLE_YYABORT; }
4607
{ if (add_group_to_list(YYTHD, $3,(bool) $4)) DRIZZLE_YYABORT; }
4490
4608
| order_ident order_dir
4491
{ if (add_group_to_list(YYSession, $1,(bool) $2)) DRIZZLE_YYABORT; }
4609
{ if (add_group_to_list(YYTHD, $1,(bool) $2)) DRIZZLE_YYABORT; }
4617
'WITH CUBE' is reserved in the MySQL syntax, but not implemented,
4618
and cause LALR(2) conflicts.
4619
This syntax is not standard.
4620
MySQL syntax: GROUP BY col1, col2, col3 WITH CUBE
4621
SQL-2003: GROUP BY ... CUBE(col1, col2, col3)
4624
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
4626
my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
4627
"global union parameters");
4630
lex->current_select->olap= CUBE_TYPE;
4631
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
4496
4634
| WITH_ROLLUP_SYM
5661
5835
LEX_STRING tmp;
5662
Session *session= YYSession;
5663
const CHARSET_INFO * const cs_con= session->variables.collation_connection;
5664
const CHARSET_INFO * const cs_cli= session->variables.character_set_client;
5665
uint32_t repertoire= session->lex->text_string_is_7bit &&
5837
const CHARSET_INFO * const cs_con= thd->variables.collation_connection;
5838
const CHARSET_INFO * const cs_cli= thd->variables.character_set_client;
5839
uint repertoire= thd->lex->text_string_is_7bit &&
5666
5840
my_charset_is_ascii_based(cs_cli) ?
5667
5841
MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
5668
if (session->charset_is_collation_connection ||
5842
if (thd->charset_is_collation_connection ||
5669
5843
(repertoire == MY_REPERTOIRE_ASCII &&
5670
5844
my_charset_is_ascii_based(cs_con)))
5673
session->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli);
5847
thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli);
5674
5848
$$= new Item_string(tmp.str, tmp.length, cs_con,
5675
5849
DERIVATION_COERCIBLE, repertoire);
5904
6074
simple_ident_q:
5905
6075
ident '.' ident
5907
Session *session= YYSession;
5908
LEX *lex= session->lex;
5911
6081
SELECT_LEX *sel= lex->current_select;
5912
6082
if (sel->no_table_names_allowed)
5914
6084
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5915
MYF(0), $1.str, session->where);
6085
MYF(0), $1.str, thd->where);
5917
6087
$$= (sel->parsing_place != IN_HAVING ||
5918
6088
sel->get_in_sum_expr() > 0) ?
5919
(Item*) new Item_field(Lex->current_context(),
5920
(const char *)NULL, $1.str, $3.str) :
5921
(Item*) new Item_ref(Lex->current_context(),
5922
(const char *)NULL, $1.str, $3.str);
6089
(Item*) new Item_field(Lex->current_context(), NullS, $1.str, $3.str) :
6090
(Item*) new Item_ref(Lex->current_context(), NullS, $1.str, $3.str);
5925
6093
| '.' ident '.' ident
5927
Session *session= YYSession;
5928
LEX *lex= session->lex;
5929
6097
SELECT_LEX *sel= lex->current_select;
5930
6098
if (sel->no_table_names_allowed)
5932
6100
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5933
MYF(0), $2.str, session->where);
6101
MYF(0), $2.str, thd->where);
5935
6103
$$= (sel->parsing_place != IN_HAVING ||
5936
6104
sel->get_in_sum_expr() > 0) ?
5937
(Item*) new Item_field(Lex->current_context(), NULL, $2.str, $4.str) :
5938
(Item*) new Item_ref(Lex->current_context(),
5939
(const char *)NULL, $2.str, $4.str);
6105
(Item*) new Item_field(Lex->current_context(), NullS, $2.str, $4.str) :
6106
(Item*) new Item_ref(Lex->current_context(), NullS, $2.str, $4.str);
5941
6108
| ident '.' ident '.' ident
5943
Session *session= YYSession;
5944
LEX *lex= session->lex;
5945
6112
SELECT_LEX *sel= lex->current_select;
5946
6113
if (sel->no_table_names_allowed)
5948
6115
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5949
MYF(0), $3.str, session->where);
6116
MYF(0), $3.str, thd->where);
5951
6118
$$= (sel->parsing_place != IN_HAVING ||
5952
6119
sel->get_in_sum_expr() > 0) ?
5953
6120
(Item*) new Item_field(Lex->current_context(),
5954
(YYSession->client_capabilities &
5955
CLIENT_NO_SCHEMA ? NULL : $1.str),
6121
(YYTHD->client_capabilities &
6122
CLIENT_NO_SCHEMA ? NullS : $1.str),
5956
6123
$3.str, $5.str) :
5957
6124
(Item*) new Item_ref(Lex->current_context(),
5958
(YYSession->client_capabilities &
5959
CLIENT_NO_SCHEMA ? NULL : $1.str),
6125
(YYTHD->client_capabilities &
6126
CLIENT_NO_SCHEMA ? NullS : $1.str),
5960
6127
$3.str, $5.str);
6023
session->convert_string(&$$, system_charset_info,
6024
$1.str, $1.length, session->charset());
6190
thd->convert_string(&$$, system_charset_info,
6191
$1.str, $1.length, thd->charset());
6028
6195
TEXT_STRING_sys:
6031
Session *session= YYSession;
6033
if (session->charset_is_system_charset)
6200
if (thd->charset_is_system_charset)
6036
session->convert_string(&$$, system_charset_info,
6037
$1.str, $1.length, session->charset());
6203
thd->convert_string(&$$, system_charset_info,
6204
$1.str, $1.length, thd->charset());
6041
6208
TEXT_STRING_literal:
6044
Session *session= YYSession;
6046
if (session->charset_is_collation_connection)
6213
if (thd->charset_is_collation_connection)
6049
session->convert_string(&$$, session->variables.collation_connection,
6050
$1.str, $1.length, session->charset());
6216
thd->convert_string(&$$, thd->variables.collation_connection,
6217
$1.str, $1.length, thd->charset());
6054
6221
TEXT_STRING_filesystem:
6057
Session *session= YYSession;
6059
if (session->charset_is_character_set_filesystem)
6226
if (thd->charset_is_character_set_filesystem)
6062
session->convert_string(&$$, session->variables.character_set_filesystem,
6063
$1.str, $1.length, session->charset());
6229
thd->convert_string(&$$, thd->variables.character_set_filesystem,
6230
$1.str, $1.length, thd->charset());