~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Padraig O'Sullivan
  • Date: 2009-08-08 04:22:33 UTC
  • mto: (1115.3.4 captain)
  • mto: This revision was merged to the branch mainline in revision 1117.
  • Revision ID: osullivan.padraig@gmail.com-20090808042233-q0z88zc490z3f3r7
Renamed the Command class to be Statement. Renamed the command directory to
statement and also the command header file to statement. Updated various
source files to reflect this renaming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
#include <drizzled/function/get_system_var.h>
88
88
#include <mysys/thr_lock.h>
89
89
#include <drizzled/message/table.pb.h>
90
 
#include <drizzled/command.h>
91
 
#include <drizzled/command/checksum.h>
92
 
#include <drizzled/command/commit.h>
93
 
#include <drizzled/command/delete.h>
94
 
#include <drizzled/command/empty_query.h>
95
 
#include <drizzled/command/load.h>
96
 
#include <drizzled/command/rollback.h>
97
 
#include <drizzled/command/select.h>
98
 
#include <drizzled/command/show_create.h>
99
 
#include <drizzled/command/show_engine_status.h>
100
 
#include <drizzled/command/show_errors.h>
101
 
#include <drizzled/command/show_processlist.h>
102
 
#include <drizzled/command/show_status.h>
103
 
#include <drizzled/command/show_warnings.h>
 
90
#include <drizzled/statement.h>
 
91
#include <drizzled/statement/checksum.h>
 
92
#include <drizzled/statement/commit.h>
 
93
#include <drizzled/statement/delete.h>
 
94
#include <drizzled/statement/empty_query.h>
 
95
#include <drizzled/statement/load.h>
 
96
#include <drizzled/statement/rollback.h>
 
97
#include <drizzled/statement/select.h>
 
98
#include <drizzled/statement/show_create.h>
 
99
#include <drizzled/statement/show_engine_status.h>
 
100
#include <drizzled/statement/show_errors.h>
 
101
#include <drizzled/statement/show_processlist.h>
 
102
#include <drizzled/statement/show_status.h>
 
103
#include <drizzled/statement/show_warnings.h>
104
104
 
105
105
using namespace drizzled;
106
106
 
1076
1076
            else
1077
1077
            {
1078
1078
              session->lex->sql_command= SQLCOM_EMPTY_QUERY;
1079
 
              session->lex->command= 
 
1079
              session->lex->statement= 
1080
1080
                new(std::nothrow) statement::EmptyQuery(YYSession);
1081
 
              if (session->lex->command == NULL)
 
1081
              if (session->lex->statement == NULL)
1082
1082
                DRIZZLE_YYABORT;
1083
1083
            }
1084
1084
          }
2376
2376
          {
2377
2377
            LEX *lex=Lex;
2378
2378
            lex->sql_command = SQLCOM_CHECKSUM;
2379
 
            lex->command= new(std::nothrow) statement::Checksum(YYSession);
2380
 
            if (lex->command == NULL)
 
2379
            lex->statement= new(std::nothrow) statement::Checksum(YYSession);
 
2380
            if (lex->statement == NULL)
2381
2381
              DRIZZLE_YYABORT;
2382
2382
          }
2383
2383
          table_list opt_checksum_type
2480
2480
          {
2481
2481
            LEX *lex= Lex;
2482
2482
            lex->sql_command= SQLCOM_SELECT;
2483
 
            lex->command= new(std::nothrow) statement::Select(SQLCOM_SELECT,
 
2483
            lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
2484
2484
                                                            YYSession);
2485
 
            if (lex->command == NULL)
 
2485
            if (lex->statement == NULL)
2486
2486
              DRIZZLE_YYABORT;
2487
2487
          }
2488
2488
        ;
4620
4620
          {
4621
4621
            LEX *lex= Lex;
4622
4622
            lex->sql_command= SQLCOM_DELETE;
4623
 
            lex->command= new(std::nothrow) statement::Delete(YYSession);
4624
 
            if (lex->command == NULL)
 
4623
            lex->statement= new(std::nothrow) statement::Delete(YYSession);
 
4624
            if (lex->statement == NULL)
4625
4625
              DRIZZLE_YYABORT;
4626
4626
            mysql_init_select(lex);
4627
4627
            lex->lock_option= TL_WRITE_DEFAULT;
4688
4688
           {
4689
4689
             LEX *lex= Lex;
4690
4690
             lex->sql_command= SQLCOM_SHOW_DATABASES;
4691
 
             lex->command=
 
4691
             lex->statement=
4692
4692
               new(std::nothrow) statement::Select(SQLCOM_SHOW_DATABASES, 
4693
4693
                                                 YYSession);
4694
 
             if (lex->command == NULL)
 
4694
             if (lex->statement == NULL)
4695
4695
               DRIZZLE_YYABORT;
4696
4696
             if (prepare_schema_table(YYSession, lex, 0, "SCHEMATA"))
4697
4697
               DRIZZLE_YYABORT;
4700
4700
           {
4701
4701
             LEX *lex= Lex;
4702
4702
             lex->sql_command= SQLCOM_SHOW_TABLES;
4703
 
             lex->command=
 
4703
             lex->statement=
4704
4704
               new(std::nothrow) statement::Select(SQLCOM_SHOW_TABLES,
4705
4705
                                                 YYSession);
4706
 
             if (lex->command == NULL)
 
4706
             if (lex->statement == NULL)
4707
4707
               DRIZZLE_YYABORT;
4708
4708
             lex->select_lex.db= $3;
4709
4709
             if (prepare_schema_table(YYSession, lex, 0, "TABLE_NAMES"))
4713
4713
           {
4714
4714
             LEX *lex= Lex;
4715
4715
             lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
4716
 
             lex->command=
 
4716
             lex->statement=
4717
4717
               new(std::nothrow) statement::Select(SQLCOM_SHOW_TABLE_STATUS,
4718
4718
                                                 YYSession);
4719
 
             if (lex->command == NULL)
 
4719
             if (lex->statement == NULL)
4720
4720
               DRIZZLE_YYABORT;
4721
4721
             lex->select_lex.db= $3;
4722
4722
             if (prepare_schema_table(YYSession, lex, 0, "TABLES"))
4726
4726
          {
4727
4727
            LEX *lex= Lex;
4728
4728
            lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
4729
 
            lex->command=
 
4729
            lex->statement=
4730
4730
              new(std::nothrow) statement::Select(SQLCOM_SHOW_OPEN_TABLES,
4731
4731
                                                YYSession);
4732
 
            if (lex->command == NULL)
 
4732
            if (lex->statement == NULL)
4733
4733
              DRIZZLE_YYABORT;
4734
4734
            lex->select_lex.db= $3;
4735
4735
            if (prepare_schema_table(YYSession, lex, 0, "OPEN_TABLES"))
4739
4739
          { 
4740
4740
            Lex->show_engine= $2; 
4741
4741
            Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS;
4742
 
            Lex->command= 
 
4742
            Lex->statement= 
4743
4743
              new(std::nothrow) statement::ShowEngineStatus(YYSession);
4744
 
            if (Lex->command == NULL)
 
4744
            if (Lex->statement == NULL)
4745
4745
              DRIZZLE_YYABORT;
4746
4746
          }
4747
4747
        | opt_full COLUMNS from_or_in table_ident opt_db show_wild
4748
4748
          {
4749
4749
            LEX *lex= Lex;
4750
4750
            lex->sql_command= SQLCOM_SHOW_FIELDS;
4751
 
            lex->command=
 
4751
            lex->statement=
4752
4752
              new(std::nothrow) statement::Select(SQLCOM_SHOW_FIELDS, YYSession);
4753
 
            if (lex->command == NULL)
 
4753
            if (lex->statement == NULL)
4754
4754
              DRIZZLE_YYABORT;
4755
4755
            if ($5)
4756
4756
              $4->change_db($5);
4761
4761
          {
4762
4762
            LEX *lex= Lex;
4763
4763
            lex->sql_command= SQLCOM_SHOW_KEYS;
4764
 
            lex->command= new(std::nothrow) statement::Select(SQLCOM_SHOW_KEYS,
 
4764
            lex->statement= new(std::nothrow) statement::Select(SQLCOM_SHOW_KEYS,
4765
4765
                                                            YYSession);
4766
 
            if (lex->command == NULL)
 
4766
            if (lex->statement == NULL)
4767
4767
              DRIZZLE_YYABORT;
4768
4768
            if ($4)
4769
4769
              $3->change_db($4);
4774
4774
          { 
4775
4775
            (void) create_select_for_variable("warning_count"); 
4776
4776
            LEX *lex= Lex;
4777
 
            lex->command= new(std::nothrow) statement::Select(SQLCOM_SELECT,
 
4777
            lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4778
4778
                                                            YYSession);
4779
 
            if (lex->command == NULL)
 
4779
            if (lex->statement == NULL)
4780
4780
              DRIZZLE_YYABORT;
4781
4781
          }
4782
4782
        | COUNT_SYM '(' '*' ')' ERRORS
4783
4783
          { 
4784
4784
            (void) create_select_for_variable("error_count"); 
4785
4785
            LEX *lex= Lex;
4786
 
            lex->command= new(std::nothrow) statement::Select(SQLCOM_SELECT,
 
4786
            lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4787
4787
                                                            YYSession);
4788
 
            if (lex->command == NULL)
 
4788
            if (lex->statement == NULL)
4789
4789
              DRIZZLE_YYABORT;
4790
4790
          }
4791
4791
        | WARNINGS opt_limit_clause_init
4792
4792
          { 
4793
4793
            Lex->sql_command = SQLCOM_SHOW_WARNS;
4794
 
            Lex->command= new(std::nothrow) statement::ShowWarnings(YYSession);
4795
 
            if (Lex->command == NULL)
 
4794
            Lex->statement= new(std::nothrow) statement::ShowWarnings(YYSession);
 
4795
            if (Lex->statement == NULL)
4796
4796
              DRIZZLE_YYABORT;
4797
4797
          }
4798
4798
        | ERRORS opt_limit_clause_init
4799
4799
          { 
4800
4800
            Lex->sql_command = SQLCOM_SHOW_ERRORS;
4801
 
            Lex->command= new(std::nothrow) statement::ShowErrors(YYSession);
4802
 
            if (Lex->command == NULL)
 
4801
            Lex->statement= new(std::nothrow) statement::ShowErrors(YYSession);
 
4802
            if (Lex->statement == NULL)
4803
4803
              DRIZZLE_YYABORT;
4804
4804
          }
4805
4805
        | opt_var_type STATUS_SYM show_wild
4806
4806
          {
4807
4807
            LEX *lex= Lex;
4808
4808
            lex->sql_command= SQLCOM_SHOW_STATUS;
4809
 
            lex->command=
 
4809
            lex->statement=
4810
4810
              new(std::nothrow) statement::ShowStatus(YYSession,
4811
4811
                                                    &LOCK_status);
4812
 
            if (lex->command == NULL)
 
4812
            if (lex->statement == NULL)
4813
4813
              DRIZZLE_YYABORT;
4814
4814
            lex->option_type= $1;
4815
4815
            if (prepare_schema_table(YYSession, lex, 0, "STATUS"))
4818
4818
        | opt_full PROCESSLIST_SYM
4819
4819
          { 
4820
4820
            Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;
4821
 
            Lex->command= 
 
4821
            Lex->statement= 
4822
4822
              new(std::nothrow) statement::ShowProcesslist(YYSession);
4823
 
            if (Lex->command == NULL)
 
4823
            if (Lex->statement == NULL)
4824
4824
              DRIZZLE_YYABORT;
4825
4825
          }
4826
4826
        | opt_var_type  VARIABLES show_wild
4827
4827
          {
4828
4828
            LEX *lex= Lex;
4829
4829
            lex->sql_command= SQLCOM_SHOW_VARIABLES;
4830
 
            lex->command=
 
4830
            lex->statement=
4831
4831
              new(std::nothrow) statement::Select(SQLCOM_SHOW_VARIABLES, 
4832
4832
                                                YYSession);
4833
 
            if (lex->command == NULL)
 
4833
            if (lex->statement == NULL)
4834
4834
              DRIZZLE_YYABORT;
4835
4835
            lex->option_type= $1;
4836
4836
            if (prepare_schema_table(YYSession, lex, 0, "VARIABLES"))
4846
4846
          {
4847
4847
            LEX *lex= Lex;
4848
4848
            lex->sql_command = SQLCOM_SHOW_CREATE;
4849
 
            lex->command= new(std::nothrow) statement::ShowCreate(YYSession);
4850
 
            if (lex->command == NULL)
 
4849
            lex->statement= new(std::nothrow) statement::ShowCreate(YYSession);
 
4850
            if (lex->statement == NULL)
4851
4851
              DRIZZLE_YYABORT;
4852
4852
            if (!lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
4853
4853
              DRIZZLE_YYABORT;
4894
4894
            mysql_init_select(lex);
4895
4895
            lex->current_select->parsing_place= SELECT_LIST;
4896
4896
            lex->sql_command= SQLCOM_SHOW_FIELDS;
4897
 
            lex->command= new(std::nothrow) statement::Select(SQLCOM_SHOW_FIELDS,
 
4897
            lex->statement= new(std::nothrow) statement::Select(SQLCOM_SHOW_FIELDS,
4898
4898
                                                            YYSession);
4899
 
            if (lex->command == NULL)
 
4899
            if (lex->statement == NULL)
4900
4900
              DRIZZLE_YYABORT;
4901
4901
            lex->select_lex.db= 0;
4902
4902
            lex->verbose= 0;
5014
5014
          {
5015
5015
            LEX *lex=Lex;
5016
5016
            lex->sql_command= SQLCOM_LOAD;
5017
 
            lex->command= new(std::nothrow) statement::Load(YYSession);
5018
 
            if (lex->command == NULL)
 
5017
            lex->statement= new(std::nothrow) statement::Load(YYSession);
 
5018
            if (lex->statement == NULL)
5019
5019
              DRIZZLE_YYABORT;
5020
5020
            lex->lock_option= $4;
5021
5021
            lex->duplicates= DUP_ERROR;
5894
5894
          {
5895
5895
            LEX *lex=Lex;
5896
5896
            lex->sql_command= SQLCOM_COMMIT;
5897
 
            lex->command= new(std::nothrow) statement::Commit(YYSession);
5898
 
            if (lex->command == NULL)
 
5897
            lex->statement= new(std::nothrow) statement::Commit(YYSession);
 
5898
            if (lex->statement == NULL)
5899
5899
              DRIZZLE_YYABORT;
5900
5900
            lex->tx_chain= $3; 
5901
5901
            lex->tx_release= $4;
5907
5907
          {
5908
5908
            LEX *lex=Lex;
5909
5909
            lex->sql_command= SQLCOM_ROLLBACK;
5910
 
            lex->command= new(std::nothrow) statement::Rollback(YYSession);
5911
 
            if (lex->command == NULL)
 
5910
            lex->statement= new(std::nothrow) statement::Rollback(YYSession);
 
5911
            if (lex->statement == NULL)
5912
5912
              DRIZZLE_YYABORT;
5913
5913
            lex->tx_chain= $3; 
5914
5914
            lex->tx_release= $4;