~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2010-10-15 00:10:43 UTC
  • mto: This revision was merged to the branch mainline in revision 1851.
  • Revision ID: brian@tangent.org-20101015001043-df9lfy4rubdiwa4d
This patch returns dynamic SQL into the core (through SQL-Server syntax).
This will allow us to add back in the test cases that were using
DECLARE/PREPARE syntax (which... was a last minutes decision in 5.0 to allow
so that we could have "dynamic" SQL). 

Show diffs side-by-side

added added

removed removed

Lines of Context:
521
521
%token  ESCAPED
522
522
%token  ESCAPE_SYM                    /* SQL-2003-R */
523
523
%token  EXCLUSIVE_SYM
 
524
%token  EXECUTE_SYM
524
525
%token  EXISTS                        /* SQL-2003-R */
525
526
%token  EXTENDED_SYM
526
527
%token  EXTRACT_SYM                   /* SQL-2003-N */
802
803
        IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
803
804
        opt_component
804
805
        BIN_NUM TEXT_STRING_filesystem ident_or_empty
 
806
        execute_var_or_string
805
807
        opt_constraint constraint opt_ident
806
808
 
807
809
%type <lex_str_ptr>
935
937
        statement
936
938
        opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
937
939
        init_key_options key_options key_opts key_opt key_using_alg
 
940
        execute
938
941
END_OF_INPUT
939
942
 
940
943
%type <index_hint> index_hint_type
1004
1007
        | delete
1005
1008
        | describe
1006
1009
        | drop
 
1010
        | execute
1007
1011
        | flush
1008
1012
        | insert
1009
1013
        | kill
4462
4466
          /* empty */ { $$= 0; }
4463
4467
        | TEMPORARY_SYM { $$= 1; }
4464
4468
        ;
 
4469
 
 
4470
/*
 
4471
  Execute a string as dynamic SQL.
 
4472
  */
 
4473
 
 
4474
execute:
 
4475
       EXECUTE_SYM
 
4476
       {
 
4477
          LEX *lex= Lex;
 
4478
          statement::Execute *statement= new(std::nothrow) statement::Execute(YYSession);
 
4479
          lex->statement= statement;
 
4480
          if (lex->statement == NULL)
 
4481
            DRIZZLE_YYABORT;
 
4482
       }
 
4483
       execute_var_or_string
 
4484
 
 
4485
 
 
4486
execute_var_or_string:
 
4487
         ident_or_text
 
4488
         {
 
4489
          statement::Execute *statement= (statement::Execute *)Lex->statement;
 
4490
          statement->setQuery($1);
 
4491
         }
 
4492
        | '@' ident_or_text
 
4493
        {
 
4494
          statement::Execute *statement= (statement::Execute *)Lex->statement;
 
4495
          statement->setVar();
 
4496
          statement->setQuery($2);
 
4497
        }
 
4498
 
4465
4499
/*
4466
4500
** Insert : add new data to table
4467
4501
*/