1255
1256
CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident
1258
Session *session= YYSession;
1259
LEX *lex= session->lex;
1259
1260
lex->sql_command= SQLCOM_CREATE_TABLE;
1260
if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
1261
if (!lex->select_lex.add_table_to_list(session, $5, NULL,
1261
1262
TL_OPTION_UPDATING,
1263
1264
DRIZZLE_YYABORT;
1264
1265
lex->alter_info.reset();
1265
1266
lex->col_list.empty();
1267
1268
memset(&lex->create_info, 0, sizeof(lex->create_info));
1268
1269
lex->create_info.options=$2 | $4;
1269
lex->create_info.db_type= ha_default_handlerton(thd);
1270
lex->create_info.db_type= ha_default_handlerton(session);
1270
1271
lex->create_info.default_table_charset= NULL;
1271
1272
lex->name.str= 0;
1272
1273
lex->name.length= 0;
1276
LEX *lex= YYTHD->lex;
1277
LEX *lex= YYSession->lex;
1277
1278
lex->current_select= &lex->select_lex;
1278
1279
if (!lex->create_info.db_type)
1280
lex->create_info.db_type= ha_default_handlerton(YYTHD);
1281
push_warning_printf(YYTHD, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1281
lex->create_info.db_type= ha_default_handlerton(YYSession);
1282
push_warning_printf(YYSession, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1282
1283
ER_WARN_USING_OTHER_HANDLER,
1283
1284
ER(ER_WARN_USING_OTHER_HANDLER),
1284
1285
ha_resolve_storage_engine_name(lex->create_info.db_type),
1720
1716
lex->comment=null_lex_str;
1721
1717
lex->charset=NULL;
1722
1718
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
1719
lex->vcol_info= NULL;
1727
if (add_field_to_list(lex->thd, &$1, (enum enum_field_types) $3,
1724
if (add_field_to_list(lex->session, &$1, (enum enum_field_types) $3,
1728
1725
lex->length,lex->dec,lex->type,
1729
1726
lex->column_format,
1730
1727
lex->default_value, lex->on_update_value,
1732
lex->change,&lex->interval_list,lex->charset))
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;
1738
int_type field_options
1741
1809
Lex->length=(char*) 0; /* use default length */
1743
| real_type opt_precision field_options { $$=$1; }
1746
Lex->length= (char*) "1";
1747
$$=DRIZZLE_TYPE_TINY;
1751
Lex->length=(char*) "1";
1752
$$=DRIZZLE_TYPE_TINY;
1756
Lex->length=(char*) "1";
1757
$$=DRIZZLE_TYPE_TINY;
1811
| real_type opt_precision { $$=$1; }
1759
1812
| char '(' NUM ')' opt_binary
1761
1814
Lex->length=$3.str;
3099
$$ = new (YYTHD->mem_root) Item_cond_and($1, $3);
3131
$$ = new (YYSession->mem_root) Item_cond_and($1, $3);
3102
3134
| NOT_SYM expr %prec NOT_SYM
3103
{ $$= negate_expression(YYTHD, $2); }
3135
{ $$= negate_expression(YYSession, $2); }
3104
3136
| bool_pri IS TRUE_SYM %prec IS
3105
{ $$= new (YYTHD->mem_root) Item_func_istrue($1); }
3137
{ $$= new (YYSession->mem_root) Item_func_istrue($1); }
3106
3138
| bool_pri IS not TRUE_SYM %prec IS
3107
{ $$= new (YYTHD->mem_root) Item_func_isnottrue($1); }
3139
{ $$= new (YYSession->mem_root) Item_func_isnottrue($1); }
3108
3140
| bool_pri IS FALSE_SYM %prec IS
3109
{ $$= new (YYTHD->mem_root) Item_func_isfalse($1); }
3141
{ $$= new (YYSession->mem_root) Item_func_isfalse($1); }
3110
3142
| bool_pri IS not FALSE_SYM %prec IS
3111
{ $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); }
3143
{ $$= new (YYSession->mem_root) Item_func_isnotfalse($1); }
3112
3144
| bool_pri IS UNKNOWN_SYM %prec IS
3113
3145
{ $$= new Item_func_isnull($1); }
3114
3146
| bool_pri IS not UNKNOWN_SYM %prec IS
3134
3166
bit_expr IN_SYM '(' subselect ')'
3136
$$= new (YYTHD->mem_root) Item_in_subselect($1, $4);
3168
$$= new (YYSession->mem_root) Item_in_subselect($1, $4);
3138
3170
| bit_expr not IN_SYM '(' subselect ')'
3141
Item *item= new (thd->mem_root) Item_in_subselect($1, $5);
3142
$$= negate_expression(thd, item);
3172
Session *session= YYSession;
3173
Item *item= new (session->mem_root) Item_in_subselect($1, $5);
3174
$$= negate_expression(session, item);
3144
3176
| bit_expr IN_SYM '(' expr ')'
3146
$$= handle_sql2003_note184_exception(YYTHD, $1, true, $4);
3178
$$= handle_sql2003_note184_exception(YYSession, $1, true, $4);
3148
3180
| bit_expr IN_SYM '(' expr ',' expr_list ')'
3150
3182
$6->push_front($4);
3151
3183
$6->push_front($1);
3152
$$= new (YYTHD->mem_root) Item_func_in(*$6);
3184
$$= new (YYSession->mem_root) Item_func_in(*$6);
3154
3186
| bit_expr not IN_SYM '(' expr ')'
3156
$$= handle_sql2003_note184_exception(YYTHD, $1, false, $5);
3188
$$= handle_sql2003_note184_exception(YYSession, $1, false, $5);
3158
3190
| bit_expr not IN_SYM '(' expr ',' expr_list ')'
3160
3192
$7->push_front($5);
3161
3193
$7->push_front($1);
3162
Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7);
3194
Item_func_in *item = new (YYSession->mem_root) Item_func_in(*$7);
3163
3195
item->negate();
3234
3266
| function_call_conflict
3235
3267
| simple_expr COLLATE_SYM ident_or_text %prec NEG
3238
Item *i1= new (thd->mem_root) Item_string($3.str,
3269
Session *session= YYSession;
3270
Item *i1= new (session->mem_root) Item_string($3.str,
3241
$$= new (thd->mem_root) Item_func_set_collation($1, i1);
3272
session->charset());
3273
$$= new (session->mem_root) Item_func_set_collation($1, i1);
3246
3278
| '+' simple_expr %prec NEG { $$= $2; }
3247
3279
| '-' simple_expr %prec NEG
3248
{ $$= new (YYTHD->mem_root) Item_func_neg($2); }
3280
{ $$= new (YYSession->mem_root) Item_func_neg($2); }
3249
3281
| '(' subselect ')'
3251
$$= new (YYTHD->mem_root) Item_singlerow_subselect($2);
3283
$$= new (YYSession->mem_root) Item_singlerow_subselect($2);
3253
3285
| '(' expr ')' { $$= $2; }
3254
3286
| '(' expr ',' expr_list ')'
3256
3288
$4->push_front($2);
3257
$$= new (YYTHD->mem_root) Item_row(*$4);
3289
$$= new (YYSession->mem_root) Item_row(*$4);
3259
3291
| ROW_SYM '(' expr ',' expr_list ')'
3261
3293
$5->push_front($3);
3262
$$= new (YYTHD->mem_root) Item_row(*$5);
3294
$$= new (YYSession->mem_root) Item_row(*$5);
3264
3296
| EXISTS '(' subselect ')'
3266
$$= new (YYTHD->mem_root) Item_exists_subselect($3);
3298
$$= new (YYSession->mem_root) Item_exists_subselect($3);
3268
3300
| '{' ident expr '}' { $$= $3; }
3269
3301
| BINARY simple_expr %prec NEG
3271
$$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL,
3303
$$= create_func_cast(YYSession, $2, ITEM_CAST_CHAR, NULL, NULL,
3272
3304
&my_charset_bin);
3274
3306
| CAST_SYM '(' expr AS cast_type ')'
3277
$$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec,
3309
$$= create_func_cast(YYSession, $3, $5, lex->length, lex->dec,
3280
3312
DRIZZLE_YYABORT;
3282
3314
| CASE_SYM opt_expr when_list opt_else END
3283
{ $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 ); }
3315
{ $$= new (YYSession->mem_root) Item_func_case(* $3, $2, $4 ); }
3284
3316
| CONVERT_SYM '(' expr ',' cast_type ')'
3286
$$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec,
3318
$$= create_func_cast(YYSession, $3, $5, Lex->length, Lex->dec,
3289
3321
DRIZZLE_YYABORT;
3291
3323
| DEFAULT '(' simple_ident ')'
3293
$$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(),
3325
$$= new (YYSession->mem_root) Item_default_value(Lex->current_context(),
3296
3328
| VALUES '(' simple_ident_nospvar ')'
3298
$$= new (YYTHD->mem_root) Item_insert_value(Lex->current_context(),
3330
$$= new (YYSession->mem_root) Item_insert_value(Lex->current_context(),
3301
3333
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
3302
3334
/* we cannot put interval before - */
3303
{ $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0); }
3335
{ $$= new (YYSession->mem_root) Item_date_add_interval($5,$2,$3,0); }
3312
3344
function_call_keyword:
3313
3345
CHAR_SYM '(' expr_list ')'
3314
{ $$= new (YYTHD->mem_root) Item_func_char(*$3); }
3346
{ $$= new (YYSession->mem_root) Item_func_char(*$3); }
3315
3347
| CURRENT_USER optional_braces
3317
$$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
3349
$$= new (YYSession->mem_root) Item_func_current_user(Lex->current_context());
3318
3350
Lex->set_stmt_unsafe();
3320
3352
| DATE_SYM '(' expr ')'
3321
{ $$= new (YYTHD->mem_root) Item_date_typecast($3); }
3353
{ $$= new (YYSession->mem_root) Item_date_typecast($3); }
3322
3354
| DAY_SYM '(' expr ')'
3323
{ $$= new (YYTHD->mem_root) Item_func_dayofmonth($3); }
3355
{ $$= new (YYSession->mem_root) Item_func_dayofmonth($3); }
3324
3356
| HOUR_SYM '(' expr ')'
3325
{ $$= new (YYTHD->mem_root) Item_func_hour($3); }
3357
{ $$= new (YYSession->mem_root) Item_func_hour($3); }
3326
3358
| INSERT '(' expr ',' expr ',' expr ',' expr ')'
3327
{ $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9); }
3359
{ $$= new (YYSession->mem_root) Item_func_insert($3,$5,$7,$9); }
3328
3360
| INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
3331
List<Item> *list= new (thd->mem_root) List<Item>;
3362
Session *session= YYSession;
3363
List<Item> *list= new (session->mem_root) List<Item>;
3332
3364
list->push_front($5);
3333
3365
list->push_front($3);
3334
Item_row *item= new (thd->mem_root) Item_row(*list);
3335
$$= new (thd->mem_root) Item_func_interval(item);
3366
Item_row *item= new (session->mem_root) Item_row(*list);
3367
$$= new (session->mem_root) Item_func_interval(item);
3337
3369
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
3371
Session *session= YYSession;
3340
3372
$7->push_front($5);
3341
3373
$7->push_front($3);
3342
Item_row *item= new (thd->mem_root) Item_row(*$7);
3343
$$= new (thd->mem_root) Item_func_interval(item);
3374
Item_row *item= new (session->mem_root) Item_row(*$7);
3375
$$= new (session->mem_root) Item_func_interval(item);
3345
3377
| LEFT '(' expr ',' expr ')'
3346
{ $$= new (YYTHD->mem_root) Item_func_left($3,$5); }
3378
{ $$= new (YYSession->mem_root) Item_func_left($3,$5); }
3347
3379
| MINUTE_SYM '(' expr ')'
3348
{ $$= new (YYTHD->mem_root) Item_func_minute($3); }
3380
{ $$= new (YYSession->mem_root) Item_func_minute($3); }
3349
3381
| MONTH_SYM '(' expr ')'
3350
{ $$= new (YYTHD->mem_root) Item_func_month($3); }
3382
{ $$= new (YYSession->mem_root) Item_func_month($3); }
3351
3383
| RIGHT '(' expr ',' expr ')'
3352
{ $$= new (YYTHD->mem_root) Item_func_right($3,$5); }
3384
{ $$= new (YYSession->mem_root) Item_func_right($3,$5); }
3353
3385
| SECOND_SYM '(' expr ')'
3354
{ $$= new (YYTHD->mem_root) Item_func_second($3); }
3386
{ $$= new (YYSession->mem_root) Item_func_second($3); }
3355
3387
| TIME_SYM '(' expr ')'
3356
{ $$= new (YYTHD->mem_root) Item_time_typecast($3); }
3388
{ $$= new (YYSession->mem_root) Item_time_typecast($3); }
3357
3389
| TIMESTAMP '(' expr ')'
3358
{ $$= new (YYTHD->mem_root) Item_datetime_typecast($3); }
3390
{ $$= new (YYSession->mem_root) Item_datetime_typecast($3); }
3359
3391
| TIMESTAMP '(' expr ',' expr ')'
3360
{ $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0); }
3392
{ $$= new (YYSession->mem_root) Item_func_add_time($3, $5, 1, 0); }
3361
3393
| TRIM '(' expr ')'
3362
{ $$= new (YYTHD->mem_root) Item_func_trim($3); }
3394
{ $$= new (YYSession->mem_root) Item_func_trim($3); }
3363
3395
| TRIM '(' LEADING expr FROM expr ')'
3364
{ $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4); }
3396
{ $$= new (YYSession->mem_root) Item_func_ltrim($6,$4); }
3365
3397
| TRIM '(' TRAILING expr FROM expr ')'
3366
{ $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4); }
3398
{ $$= new (YYSession->mem_root) Item_func_rtrim($6,$4); }
3367
3399
| TRIM '(' BOTH expr FROM expr ')'
3368
{ $$= new (YYTHD->mem_root) Item_func_trim($6,$4); }
3400
{ $$= new (YYSession->mem_root) Item_func_trim($6,$4); }
3369
3401
| TRIM '(' LEADING FROM expr ')'
3370
{ $$= new (YYTHD->mem_root) Item_func_ltrim($5); }
3402
{ $$= new (YYSession->mem_root) Item_func_ltrim($5); }
3371
3403
| TRIM '(' TRAILING FROM expr ')'
3372
{ $$= new (YYTHD->mem_root) Item_func_rtrim($5); }
3404
{ $$= new (YYSession->mem_root) Item_func_rtrim($5); }
3373
3405
| TRIM '(' BOTH FROM expr ')'
3374
{ $$= new (YYTHD->mem_root) Item_func_trim($5); }
3406
{ $$= new (YYSession->mem_root) Item_func_trim($5); }
3375
3407
| TRIM '(' expr FROM expr ')'
3376
{ $$= new (YYTHD->mem_root) Item_func_trim($5,$3); }
3408
{ $$= new (YYSession->mem_root) Item_func_trim($5,$3); }
3379
$$= new (YYTHD->mem_root) Item_func_user();
3411
$$= new (YYSession->mem_root) Item_func_user();
3380
3412
Lex->set_stmt_unsafe();
3382
3414
| YEAR_SYM '(' expr ')'
3383
{ $$= new (YYTHD->mem_root) Item_func_year($3); }
3415
{ $$= new (YYSession->mem_root) Item_func_year($3); }
3398
3430
function_call_nonkeyword:
3399
3431
ADDDATE_SYM '(' expr ',' expr ')'
3401
$$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
3433
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5,
3402
3434
INTERVAL_DAY, 0);
3404
3436
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
3405
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0); }
3437
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 0); }
3406
3438
| CURDATE optional_braces
3408
$$= new (YYTHD->mem_root) Item_func_curdate_local();
3440
$$= new (YYSession->mem_root) Item_func_curdate_local();
3410
3442
| CURTIME optional_braces
3412
$$= new (YYTHD->mem_root) Item_func_curtime_local();
3444
$$= new (YYSession->mem_root) Item_func_curtime_local();
3414
3446
| CURTIME '(' expr ')'
3416
$$= new (YYTHD->mem_root) Item_func_curtime_local($3);
3448
$$= new (YYSession->mem_root) Item_func_curtime_local($3);
3418
3450
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
3419
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0); }
3451
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,0); }
3420
3452
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM
3421
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,1); }
3453
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,1); }
3422
3454
| EXTRACT_SYM '(' interval FROM expr ')'
3423
{ $$=new (YYTHD->mem_root) Item_extract( $3, $5); }
3455
{ $$=new (YYSession->mem_root) Item_extract( $3, $5); }
3424
3456
| GET_FORMAT '(' date_time_type ',' expr ')'
3425
{ $$= new (YYTHD->mem_root) Item_func_get_format($3, $5); }
3457
{ $$= new (YYSession->mem_root) Item_func_get_format($3, $5); }
3426
3458
| NOW_SYM optional_braces
3428
$$= new (YYTHD->mem_root) Item_func_now_local();
3460
$$= new (YYSession->mem_root) Item_func_now_local();
3430
3462
| NOW_SYM '(' expr ')'
3432
$$= new (YYTHD->mem_root) Item_func_now_local($3);
3464
$$= new (YYSession->mem_root) Item_func_now_local($3);
3434
3466
| POSITION_SYM '(' bit_expr IN_SYM expr ')'
3435
{ $$ = new (YYTHD->mem_root) Item_func_locate($5,$3); }
3467
{ $$ = new (YYSession->mem_root) Item_func_locate($5,$3); }
3436
3468
| SUBDATE_SYM '(' expr ',' expr ')'
3438
$$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
3470
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5,
3439
3471
INTERVAL_DAY, 1);
3441
3473
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
3442
{ $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 1); }
3474
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 1); }
3443
3475
| SUBSTRING '(' expr ',' expr ',' expr ')'
3444
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); }
3476
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5,$7); }
3445
3477
| SUBSTRING '(' expr ',' expr ')'
3446
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5); }
3478
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5); }
3447
3479
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
3448
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7); }
3480
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5,$7); }
3449
3481
| SUBSTRING '(' expr FROM expr ')'
3450
{ $$= new (YYTHD->mem_root) Item_func_substr($3,$5); }
3482
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5); }
3451
3483
| SYSDATE optional_braces
3453
3485
if (global_system_variables.sysdate_is_now == 0)
3454
$$= new (YYTHD->mem_root) Item_func_sysdate_local();
3486
$$= new (YYSession->mem_root) Item_func_sysdate_local();
3456
$$= new (YYTHD->mem_root) Item_func_now_local();
3488
$$= new (YYSession->mem_root) Item_func_now_local();
3458
3490
| SYSDATE '(' expr ')'
3460
3492
if (global_system_variables.sysdate_is_now == 0)
3461
$$= new (YYTHD->mem_root) Item_func_sysdate_local($3);
3493
$$= new (YYSession->mem_root) Item_func_sysdate_local($3);
3463
$$= new (YYTHD->mem_root) Item_func_now_local($3);
3495
$$= new (YYSession->mem_root) Item_func_now_local($3);
3465
3497
| TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
3466
{ $$= new (YYTHD->mem_root) Item_date_add_interval($7,$5,$3,0); }
3498
{ $$= new (YYSession->mem_root) Item_date_add_interval($7,$5,$3,0); }
3467
3499
| TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
3468
{ $$= new (YYTHD->mem_root) Item_func_timestamp_diff($5,$7,$3); }
3500
{ $$= new (YYSession->mem_root) Item_func_timestamp_diff($5,$7,$3); }
3469
3501
| UTC_DATE_SYM optional_braces
3471
$$= new (YYTHD->mem_root) Item_func_curdate_utc();
3503
$$= new (YYSession->mem_root) Item_func_curdate_utc();
3473
3505
| UTC_TIME_SYM optional_braces
3475
$$= new (YYTHD->mem_root) Item_func_curtime_utc();
3507
$$= new (YYSession->mem_root) Item_func_curtime_utc();
3477
3509
| UTC_TIMESTAMP_SYM optional_braces
3479
$$= new (YYTHD->mem_root) Item_func_now_utc();
3511
$$= new (YYSession->mem_root) Item_func_now_utc();
3488
3520
function_call_conflict:
3489
3521
ASCII_SYM '(' expr ')'
3490
{ $$= new (YYTHD->mem_root) Item_func_ascii($3); }
3522
{ $$= new (YYSession->mem_root) Item_func_ascii($3); }
3491
3523
| COALESCE '(' expr_list ')'
3492
{ $$= new (YYTHD->mem_root) Item_func_coalesce(* $3); }
3524
{ $$= new (YYSession->mem_root) Item_func_coalesce(* $3); }
3493
3525
| COLLATION_SYM '(' expr ')'
3494
{ $$= new (YYTHD->mem_root) Item_func_collation($3); }
3526
{ $$= new (YYSession->mem_root) Item_func_collation($3); }
3495
3527
| DATABASE '(' ')'
3497
$$= new (YYTHD->mem_root) Item_func_database();
3529
$$= new (YYSession->mem_root) Item_func_database();
3499
3531
| IF '(' expr ',' expr ',' expr ')'
3500
{ $$= new (YYTHD->mem_root) Item_func_if($3,$5,$7); }
3532
{ $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); }
3501
3533
| MICROSECOND_SYM '(' expr ')'
3502
{ $$= new (YYTHD->mem_root) Item_func_microsecond($3); }
3534
{ $$= new (YYSession->mem_root) Item_func_microsecond($3); }
3503
3535
| MOD_SYM '(' expr ',' expr ')'
3504
{ $$ = new (YYTHD->mem_root) Item_func_mod( $3, $5); }
3536
{ $$ = new (YYSession->mem_root) Item_func_mod( $3, $5); }
3505
3537
| QUARTER_SYM '(' expr ')'
3506
{ $$ = new (YYTHD->mem_root) Item_func_quarter($3); }
3538
{ $$ = new (YYSession->mem_root) Item_func_quarter($3); }
3507
3539
| REPEAT_SYM '(' expr ',' expr ')'
3508
{ $$= new (YYTHD->mem_root) Item_func_repeat($3,$5); }
3540
{ $$= new (YYSession->mem_root) Item_func_repeat($3,$5); }
3509
3541
| REPLACE '(' expr ',' expr ',' expr ')'
3510
{ $$= new (YYTHD->mem_root) Item_func_replace($3,$5,$7); }
3542
{ $$= new (YYSession->mem_root) Item_func_replace($3,$5,$7); }
3511
3543
| REVERSE_SYM '(' expr ')'
3512
{ $$= new (YYTHD->mem_root) Item_func_reverse($3); }
3544
{ $$= new (YYSession->mem_root) Item_func_reverse($3); }
3513
3545
| TRUNCATE_SYM '(' expr ',' expr ')'
3514
{ $$= new (YYTHD->mem_root) Item_func_round($3,$5,1); }
3546
{ $$= new (YYSession->mem_root) Item_func_round($3,$5,1); }
3515
3547
| WEEK_SYM '(' expr ')'
3518
Item *i1= new (thd->mem_root) Item_int((char*) "0",
3519
thd->variables.default_week_format,
3549
Session *session= YYSession;
3550
Item *i1= new (session->mem_root) Item_int((char*) "0",
3551
session->variables.default_week_format,
3522
$$= new (thd->mem_root) Item_func_week($3, i1);
3554
$$= new (session->mem_root) Item_func_week($3, i1);
3524
3556
| WEEK_SYM '(' expr ',' expr ')'
3525
{ $$= new (YYTHD->mem_root) Item_func_week($3,$5); }
3557
{ $$= new (YYSession->mem_root) Item_func_week($3,$5); }
3526
3558
| WEIGHT_STRING_SYM '(' expr opt_ws_levels ')'
3527
{ $$= new (YYTHD->mem_root) Item_func_weight_string($3, 0, $4); }
3559
{ $$= new (YYSession->mem_root) Item_func_weight_string($3, 0, $4); }
3528
3560
| WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')'
3530
$$= new (YYTHD->mem_root)
3562
$$= new (YYSession->mem_root)
3531
3563
Item_func_weight_string($3, $6, $7|MY_STRXFRM_PAD_WITH_SPACE);
3533
3565
| WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')'
3535
$3= create_func_char_cast(YYTHD, $3, $6, &my_charset_bin);
3536
$$= new (YYTHD->mem_root)
3567
$3= create_func_char_cast(YYSession, $3, $6, &my_charset_bin);
3568
$$= new (YYSession->mem_root)
3537
3569
Item_func_weight_string($3, $6, MY_STRXFRM_PAD_WITH_SPACE);
4478
4488
group_list ',' order_ident order_dir
4479
{ if (add_group_to_list(YYTHD, $3,(bool) $4)) DRIZZLE_YYABORT; }
4489
{ if (add_group_to_list(YYSession, $3,(bool) $4)) DRIZZLE_YYABORT; }
4480
4490
| order_ident order_dir
4481
{ if (add_group_to_list(YYTHD, $1,(bool) $2)) DRIZZLE_YYABORT; }
4491
{ if (add_group_to_list(YYSession, $1,(bool) $2)) DRIZZLE_YYABORT; }
4489
'WITH CUBE' is reserved in the MySQL syntax, but not implemented,
4490
and cause LALR(2) conflicts.
4491
This syntax is not standard.
4492
MySQL syntax: GROUP BY col1, col2, col3 WITH CUBE
4493
SQL-2003: GROUP BY ... CUBE(col1, col2, col3)
4496
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
4498
my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
4499
"global union parameters");
4502
lex->current_select->olap= CUBE_TYPE;
4503
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
4506
4496
| WITH_ROLLUP_SYM
5704
5661
LEX_STRING tmp;
5706
const CHARSET_INFO * const cs_con= thd->variables.collation_connection;
5707
const CHARSET_INFO * const cs_cli= thd->variables.character_set_client;
5708
uint repertoire= thd->lex->text_string_is_7bit &&
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 &&
5709
5666
my_charset_is_ascii_based(cs_cli) ?
5710
5667
MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
5711
if (thd->charset_is_collation_connection ||
5668
if (session->charset_is_collation_connection ||
5712
5669
(repertoire == MY_REPERTOIRE_ASCII &&
5713
5670
my_charset_is_ascii_based(cs_con)))
5716
thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli);
5673
session->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli);
5717
5674
$$= new Item_string(tmp.str, tmp.length, cs_con,
5718
5675
DERIVATION_COERCIBLE, repertoire);
5943
5904
simple_ident_q:
5944
5905
ident '.' ident
5907
Session *session= YYSession;
5908
LEX *lex= session->lex;
5950
5911
SELECT_LEX *sel= lex->current_select;
5951
5912
if (sel->no_table_names_allowed)
5953
5914
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5954
MYF(0), $1.str, thd->where);
5915
MYF(0), $1.str, session->where);
5956
5917
$$= (sel->parsing_place != IN_HAVING ||
5957
5918
sel->get_in_sum_expr() > 0) ?
5958
(Item*) new Item_field(Lex->current_context(), NullS, $1.str, $3.str) :
5959
(Item*) new Item_ref(Lex->current_context(), NullS, $1.str, $3.str);
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);
5962
5925
| '.' ident '.' ident
5927
Session *session= YYSession;
5928
LEX *lex= session->lex;
5966
5929
SELECT_LEX *sel= lex->current_select;
5967
5930
if (sel->no_table_names_allowed)
5969
5932
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5970
MYF(0), $2.str, thd->where);
5933
MYF(0), $2.str, session->where);
5972
5935
$$= (sel->parsing_place != IN_HAVING ||
5973
5936
sel->get_in_sum_expr() > 0) ?
5974
(Item*) new Item_field(Lex->current_context(), NullS, $2.str, $4.str) :
5975
(Item*) new Item_ref(Lex->current_context(), NullS, $2.str, $4.str);
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);
5977
5941
| ident '.' ident '.' ident
5943
Session *session= YYSession;
5944
LEX *lex= session->lex;
5981
5945
SELECT_LEX *sel= lex->current_select;
5982
5946
if (sel->no_table_names_allowed)
5984
5948
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
5985
MYF(0), $3.str, thd->where);
5949
MYF(0), $3.str, session->where);
5987
5951
$$= (sel->parsing_place != IN_HAVING ||
5988
5952
sel->get_in_sum_expr() > 0) ?
5989
5953
(Item*) new Item_field(Lex->current_context(),
5990
(YYTHD->client_capabilities &
5991
CLIENT_NO_SCHEMA ? NullS : $1.str),
5954
(YYSession->client_capabilities &
5955
CLIENT_NO_SCHEMA ? NULL : $1.str),
5992
5956
$3.str, $5.str) :
5993
5957
(Item*) new Item_ref(Lex->current_context(),
5994
(YYTHD->client_capabilities &
5995
CLIENT_NO_SCHEMA ? NullS : $1.str),
5958
(YYSession->client_capabilities &
5959
CLIENT_NO_SCHEMA ? NULL : $1.str),
5996
5960
$3.str, $5.str);
6059
thd->convert_string(&$$, system_charset_info,
6060
$1.str, $1.length, thd->charset());
6023
session->convert_string(&$$, system_charset_info,
6024
$1.str, $1.length, session->charset());
6064
6028
TEXT_STRING_sys:
6031
Session *session= YYSession;
6069
if (thd->charset_is_system_charset)
6033
if (session->charset_is_system_charset)
6072
thd->convert_string(&$$, system_charset_info,
6073
$1.str, $1.length, thd->charset());
6036
session->convert_string(&$$, system_charset_info,
6037
$1.str, $1.length, session->charset());
6077
6041
TEXT_STRING_literal:
6044
Session *session= YYSession;
6082
if (thd->charset_is_collation_connection)
6046
if (session->charset_is_collation_connection)
6085
thd->convert_string(&$$, thd->variables.collation_connection,
6086
$1.str, $1.length, thd->charset());
6049
session->convert_string(&$$, session->variables.collation_connection,
6050
$1.str, $1.length, session->charset());
6090
6054
TEXT_STRING_filesystem:
6057
Session *session= YYSession;
6095
if (thd->charset_is_character_set_filesystem)
6059
if (session->charset_is_character_set_filesystem)
6098
thd->convert_string(&$$, thd->variables.character_set_filesystem,
6099
$1.str, $1.length, thd->charset());
6062
session->convert_string(&$$, session->variables.character_set_filesystem,
6063
$1.str, $1.length, session->charset());