~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-12-09 06:02:39 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20101209060239-t0ujftvcvd558yno
Tags: upstream-2010.12.05
ImportĀ upstreamĀ versionĀ 2010.12.05

Show diffs side-by-side

added added

removed removed

Lines of Context:
770
770
%token  VARIANCE_SYM
771
771
%token  VARYING                       /* SQL-2003-R */
772
772
%token  VAR_SAMP_SYM
 
773
%token  WAIT_SYM
773
774
%token  WARNINGS
774
775
%token  WEEK_SYM
775
776
%token  WHEN_SYM                      /* SQL-2003-R */
831
832
        union_opt select_derived_init option_type2
832
833
        opt_status
833
834
        opt_concurrent
 
835
        opt_wait
 
836
        kill_option
834
837
 
835
838
%type <m_fk_option>
836
839
        delete_option
3225
3228
          }
3226
3229
        | IF '(' expr ',' expr ',' expr ')'
3227
3230
          { $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); }
 
3231
        | KILL_SYM kill_option '(' expr ')'
 
3232
          {
 
3233
            std::string kill_str("kill");
 
3234
            List<Item> *args= new (YYSession->mem_root) List<Item>;
 
3235
            args->push_back($4);
 
3236
 
 
3237
            if ($2)
 
3238
            {
 
3239
              args->push_back(new (YYSession->mem_root) Item_uint(1));
 
3240
            }
 
3241
 
 
3242
            if (! ($$= reserved_keyword_function(YYSession, kill_str, args)))
 
3243
            {
 
3244
              DRIZZLE_YYABORT;
 
3245
            }
 
3246
          }
3228
3247
        | MICROSECOND_SYM '(' expr ')'
3229
3248
          { $$= new (YYSession->mem_root) Item_func_microsecond($3); }
3230
3249
        | MOD_SYM '(' expr ',' expr ')'
3247
3266
          }
3248
3267
        | TRUNCATE_SYM '(' expr ',' expr ')'
3249
3268
          { $$= new (YYSession->mem_root) Item_func_round($3,$5,1); }
 
3269
        | WAIT_SYM '(' expr ')'
 
3270
          {
 
3271
            std::string wait_str("wait");
 
3272
            List<Item> *args= new (YYSession->mem_root) List<Item>;
 
3273
            args->push_back($3);
 
3274
            if (! ($$= reserved_keyword_function(YYSession, wait_str, args)))
 
3275
            {
 
3276
              DRIZZLE_YYABORT;
 
3277
            }
 
3278
          }
 
3279
        | WAIT_SYM '(' expr ',' expr ')'
 
3280
          {
 
3281
            std::string wait_str("wait");
 
3282
            List<Item> *args= new (YYSession->mem_root) List<Item>;
 
3283
            args->push_back($3);
 
3284
            args->push_back($5);
 
3285
            if (! ($$= reserved_keyword_function(YYSession, wait_str, args)))
 
3286
            {
 
3287
              DRIZZLE_YYABORT;
 
3288
            }
 
3289
          }
3250
3290
        ;
3251
3291
 
3252
3292
/*
4474
4514
  */
4475
4515
 
4476
4516
execute:
4477
 
       EXECUTE_SYM execute_var_or_string opt_status opt_concurrent
 
4517
       EXECUTE_SYM execute_var_or_string opt_status opt_concurrent opt_wait
4478
4518
       {
4479
4519
          LEX *lex= Lex;
4480
 
          statement::Execute *statement= new(std::nothrow) statement::Execute(YYSession, $2, $3, $4);
 
4520
          statement::Execute *statement= new(std::nothrow) statement::Execute(YYSession, $2, $3, $4, $5);
4481
4521
          lex->statement= statement;
4482
4522
          if (lex->statement == NULL)
4483
4523
            DRIZZLE_YYABORT;
4504
4544
        | CONCURRENT { $$= 1; }
4505
4545
        ;
4506
4546
 
 
4547
opt_wait:
 
4548
          /* empty */ { $$= 0; }
 
4549
        | WAIT_SYM { $$= 1; }
 
4550
        ;
 
4551
 
4507
4552
/*
4508
4553
** Insert : add new data to table
4509
4554
*/
5431
5476
          KILL_SYM kill_option expr
5432
5477
          {
5433
5478
            LEX *lex=Lex;
 
5479
 
 
5480
            if ($2)
 
5481
            {
 
5482
              Lex->type= ONLY_KILL_QUERY;
 
5483
            }
 
5484
            else
 
5485
            {
 
5486
              Lex->type= 0;
 
5487
            }
 
5488
 
5434
5489
            lex->value_list.empty();
5435
5490
            lex->value_list.push_front($3);
5436
5491
            lex->sql_command= SQLCOM_KILL;
5441
5496
        ;
5442
5497
 
5443
5498
kill_option:
5444
 
          /* empty */ { Lex->type= 0; }
5445
 
        | CONNECTION_SYM { Lex->type= 0; }
5446
 
        | QUERY_SYM      { Lex->type= ONLY_KILL_QUERY; }
 
5499
          /* empty */ { $$= 0; }
 
5500
        | CONNECTION_SYM { $$= 0; }
 
5501
        | QUERY_SYM      { $$= 1; }
5447
5502
        ;
5448
5503
 
5449
5504
/* change database */
6191
6246
            LEX *lex=Lex;
6192
6247
            lex->option_type= $1;
6193
6248
            lex->var_list.push_back(new set_var(lex->option_type,
6194
 
                                                find_sys_var(YYSession, "tx_isolation"),
 
6249
                                                find_sys_var("tx_isolation"),
6195
6250
                                                &null_lex_str,
6196
6251
                                                new Item_int((int32_t) $5)));
6197
6252
          }
6212
6267
internal_variable_name:
6213
6268
          ident
6214
6269
          {
6215
 
            Session *session= YYSession;
6216
 
 
6217
6270
            /* We have to lookup here since local vars can shadow sysvars */
6218
6271
            {
6219
6272
              /* Not an SP local variable */
6220
 
              sys_var *tmp=find_sys_var(session, $1.str, $1.length);
 
6273
              sys_var *tmp=find_sys_var($1.str, $1.length);
6221
6274
              if (!tmp)
6222
6275
                DRIZZLE_YYABORT;
6223
6276
              $$.var= tmp;