~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2011-02-17 10:09:00 UTC
  • mfrom: (2173.2.1 clean-include-usuage)
  • Revision ID: brian@tangent.org-20110217100900-4tpuxxzdl1sj00sh
Merge Monty for headers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#define YYMAXDEPTH 3200                        /* Because of 64K stack */
38
38
#define Lex (YYSession->lex)
39
39
 
40
 
#include "config.h"
 
40
#include <config.h>
41
41
#include <cstdio>
42
 
#include "drizzled/parser.h"
 
42
#include <drizzled/parser.h>
43
43
 
44
44
int yylex(void *yylval, void *yysession);
45
45
 
442
442
%token  REPEATABLE_SYM                /* SQL-2003-N */
443
443
%token  REPEAT_SYM                    /* MYSQL-FUNC */
444
444
%token  REPLACE                       /* MYSQL-FUNC */
 
445
%token  REPLICATION
445
446
%token  RESTRICT
446
447
%token  RETURNS_SYM                   /* SQL-2003-R */
447
448
%token  RETURN_SYM                    /* SQL-2003-R */
971
972
            statement::CreateSchema *statement= (statement::CreateSchema *)Lex->statement;
972
973
            statement->schema_message.mutable_engine()->add_options()->set_name($1.str);
973
974
          }
 
975
        | REPLICATION opt_equal TRUE_SYM
 
976
          {
 
977
            parser::buildReplicationOption(Lex, true);
 
978
          }
 
979
        | REPLICATION opt_equal FALSE_SYM
 
980
          {
 
981
            parser::buildReplicationOption(Lex, false);
 
982
          }
974
983
        | ident_or_text equal ident_or_text
975
984
          {
976
985
            parser::buildSchemaOption(Lex, $1.str, $3);
1022
1031
          {
1023
1032
            Lex->table()->mutable_options()->set_auto_increment_value($3);
1024
1033
          }
 
1034
        | REPLICATION opt_equal TRUE_SYM
 
1035
          {
 
1036
            Lex->table()->mutable_options()->set_dont_replicate(false);
 
1037
          }
 
1038
        | REPLICATION opt_equal FALSE_SYM
 
1039
          {
 
1040
            Lex->table()->mutable_options()->set_dont_replicate(true);
 
1041
          }
1025
1042
        |  ROW_FORMAT_SYM equal row_format_or_text
1026
1043
          {
1027
1044
            parser::buildEngineOption(Lex, "ROW_FORMAT", $3);
1790
1807
          }
1791
1808
        | DROP FOREIGN KEY_SYM opt_ident
1792
1809
          {
1793
 
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1794
 
            statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::FOREIGN_KEY,
1795
 
                                                                    $4.str));
1796
 
            statement->alter_info.flags.set(ALTER_DROP_INDEX);
1797
 
            statement->alter_info.flags.set(ALTER_FOREIGN_KEY);
 
1810
            parser::buildAddAlterDropIndex(Lex, $4.str, true);
1798
1811
          }
1799
1812
        | DROP PRIMARY_SYM KEY_SYM
1800
1813
          {
1801
 
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1802
 
 
1803
 
            statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
1804
 
                                                               "PRIMARY"));
1805
 
            statement->alter_info.flags.set(ALTER_DROP_INDEX);
 
1814
            parser::buildAddAlterDropIndex(Lex, "PRIMARY");
1806
1815
          }
1807
1816
        | DROP key_or_index field_ident
1808
1817
          {
1809
 
            statement::AlterTable *statement= (statement::AlterTable *)Lex->statement;
1810
 
 
1811
 
            statement->alter_info.drop_list.push_back(new AlterDrop(AlterDrop::KEY,
1812
 
                                                                    $3.str));
1813
 
            statement->alter_info.flags.set(ALTER_DROP_INDEX);
 
1818
            parser::buildAddAlterDropIndex(Lex, $3.str);
1814
1819
          }
1815
1820
        | DISABLE_SYM KEYS
1816
1821
          {
2562
2567
          { $$= new (YYSession->mem_root) Item_func_char(*$3); }
2563
2568
        | CURRENT_USER optional_braces
2564
2569
          {
2565
 
            std::string user_str("user");
2566
 
            if (! ($$= parser::reserved_keyword_function(YYSession, user_str, NULL)))
 
2570
            if (! ($$= parser::reserved_keyword_function(YYSession, "user", NULL)))
2567
2571
            {
2568
2572
              DRIZZLE_YYABORT;
2569
2573
            }
2683
2687
          { $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 1); }
2684
2688
        | SUBSTRING '(' expr ',' expr ',' expr ')'
2685
2689
          {
2686
 
            std::string reverse_str("substr");
2687
2690
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2688
2691
            args->push_back($3);
2689
2692
            args->push_back($5);
2690
2693
            args->push_back($7);
2691
 
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
 
2694
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
2692
2695
            {
2693
2696
              DRIZZLE_YYABORT;
2694
2697
            }
2695
2698
          }
2696
2699
        | SUBSTRING '(' expr ',' expr ')'
2697
2700
          {
2698
 
            std::string reverse_str("substr");
2699
2701
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2700
2702
            args->push_back($3);
2701
2703
            args->push_back($5);
2702
 
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
 
2704
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
2703
2705
            {
2704
2706
              DRIZZLE_YYABORT;
2705
2707
            }
2706
2708
          }
2707
2709
        | SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
2708
2710
          {
2709
 
            std::string reverse_str("substr");
2710
2711
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2711
2712
            args->push_back($3);
2712
2713
            args->push_back($5);
2713
2714
            args->push_back($7);
2714
 
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
 
2715
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
2715
2716
            {
2716
2717
              DRIZZLE_YYABORT;
2717
2718
            }
2718
2719
          }
2719
2720
        | SUBSTRING '(' expr FROM expr ')'
2720
2721
          {
2721
 
            std::string reverse_str("substr");
2722
2722
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2723
2723
            args->push_back($3);
2724
2724
            args->push_back($5);
2725
 
            if (! ($$= parser::reserved_keyword_function(YYSession, reverse_str, args)))
 
2725
            if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args)))
2726
2726
            {
2727
2727
              DRIZZLE_YYABORT;
2728
2728
            }
2798
2798
          { $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); }
2799
2799
        | KILL_SYM kill_option '(' expr ')'
2800
2800
          {
2801
 
            std::string kill_str("kill");
2802
2801
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2803
2802
            args->push_back($4);
2804
2803
 
2807
2806
              args->push_back(new (YYSession->mem_root) Item_uint(1));
2808
2807
            }
2809
2808
 
2810
 
            if (! ($$= parser::reserved_keyword_function(YYSession, kill_str, args)))
 
2809
            if (! ($$= parser::reserved_keyword_function(YYSession, "kill", args)))
2811
2810
            {
2812
2811
              DRIZZLE_YYABORT;
2813
2812
            }
2826
2825
          { $$= new (YYSession->mem_root) Item_func_round($3,$5,1); }
2827
2826
        | WAIT_SYM '(' expr ')'
2828
2827
          {
2829
 
            std::string wait_str("wait");
2830
2828
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2831
2829
            args->push_back($3);
2832
 
            if (! ($$= parser::reserved_keyword_function(YYSession, wait_str, args)))
 
2830
            if (! ($$= parser::reserved_keyword_function(YYSession, "wait", args)))
2833
2831
            {
2834
2832
              DRIZZLE_YYABORT;
2835
2833
            }
2844
2842
          }
2845
2843
        | WAIT_SYM '(' expr ',' expr ')'
2846
2844
          {
2847
 
            std::string wait_str("wait");
2848
2845
            List<Item> *args= new (YYSession->mem_root) List<Item>;
2849
2846
            args->push_back($3);
2850
2847
            args->push_back($5);
2851
 
            if (! ($$= parser::reserved_keyword_function(YYSession, wait_str, args)))
 
2848
            if (! ($$= parser::reserved_keyword_function(YYSession, "wait", args)))
2852
2849
            {
2853
2850
              DRIZZLE_YYABORT;
2854
2851
            }