~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

Merged Padraig from lp:~posulliv/drizzle/cleanup-exec-command 

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
#include <drizzled/function/get_system_var.h>
89
89
#include <mysys/thr_lock.h>
90
90
#include <drizzled/message/table.pb.h>
 
91
#include <drizzled/command.h>
 
92
#include <drizzled/command/show_status.h>
 
93
#include <drizzled/command/default_select.h>
 
94
 
 
95
using namespace drizzled::command;
91
96
 
92
97
class Table_ident;
93
98
class Item;
2499
2504
          {
2500
2505
            LEX *lex= Lex;
2501
2506
            lex->sql_command= SQLCOM_SELECT;
 
2507
            lex->command= new DefaultSelect(SQLCOM_SELECT, 
 
2508
                                            YYSession);
 
2509
            if (lex->command == NULL)
 
2510
              DRIZZLE_YYABORT;
2502
2511
          }
2503
2512
        ;
2504
2513
 
4759
4768
           {
4760
4769
             LEX *lex= Lex;
4761
4770
             lex->sql_command= SQLCOM_SHOW_DATABASES;
 
4771
             lex->command= new DefaultSelect(SQLCOM_SHOW_DATABASES, 
 
4772
                                             YYSession);
 
4773
             if (lex->command == NULL)
 
4774
               DRIZZLE_YYABORT;
4762
4775
             if (prepare_schema_table(YYSession, lex, 0, "SCHEMATA"))
4763
4776
               DRIZZLE_YYABORT;
4764
4777
           }
4766
4779
           {
4767
4780
             LEX *lex= Lex;
4768
4781
             lex->sql_command= SQLCOM_SHOW_TABLES;
 
4782
             lex->command= new DefaultSelect(SQLCOM_SHOW_TABLES, 
 
4783
                                             YYSession);
 
4784
             if (lex->command == NULL)
 
4785
               DRIZZLE_YYABORT;
4769
4786
             lex->select_lex.db= $3;
4770
4787
             if (prepare_schema_table(YYSession, lex, 0, "TABLE_NAMES"))
4771
4788
               DRIZZLE_YYABORT;
4774
4791
           {
4775
4792
             LEX *lex= Lex;
4776
4793
             lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
 
4794
             lex->command= new DefaultSelect(SQLCOM_SHOW_TABLE_STATUS,
 
4795
                                             YYSession);
 
4796
             if (lex->command == NULL)
 
4797
               DRIZZLE_YYABORT;
4777
4798
             lex->select_lex.db= $3;
4778
4799
             if (prepare_schema_table(YYSession, lex, 0, "TABLES"))
4779
4800
               DRIZZLE_YYABORT;
4782
4803
          {
4783
4804
            LEX *lex= Lex;
4784
4805
            lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
 
4806
            lex->command= new DefaultSelect(SQLCOM_SHOW_OPEN_TABLES,
 
4807
                                            YYSession);
 
4808
            if (lex->command == NULL)
 
4809
              DRIZZLE_YYABORT;
4785
4810
            lex->select_lex.db= $3;
4786
4811
            if (prepare_schema_table(YYSession, lex, 0, "OPEN_TABLES"))
4787
4812
              DRIZZLE_YYABORT;
4795
4820
          {
4796
4821
            LEX *lex= Lex;
4797
4822
            lex->sql_command= SQLCOM_SHOW_FIELDS;
 
4823
            lex->command= new DefaultSelect(SQLCOM_SHOW_FIELDS,
 
4824
                                            YYSession);
 
4825
            if (lex->command == NULL)
 
4826
              DRIZZLE_YYABORT;
4798
4827
            if ($5)
4799
4828
              $4->change_db($5);
4800
4829
            if (prepare_schema_table(YYSession, lex, $4, "COLUMNS"))
4804
4833
          {
4805
4834
            LEX *lex= Lex;
4806
4835
            lex->sql_command= SQLCOM_SHOW_KEYS;
 
4836
            lex->command= new DefaultSelect(SQLCOM_SHOW_KEYS, 
 
4837
                                            YYSession);
 
4838
            if (lex->command == NULL)
 
4839
              DRIZZLE_YYABORT;
4807
4840
            if ($4)
4808
4841
              $3->change_db($4);
4809
4842
            if (prepare_schema_table(YYSession, lex, $3, "STATISTICS"))
4810
4843
              DRIZZLE_YYABORT;
4811
4844
          }
4812
4845
        | COUNT_SYM '(' '*' ')' WARNINGS
4813
 
          { (void) create_select_for_variable("warning_count"); }
 
4846
          { 
 
4847
            (void) create_select_for_variable("warning_count"); 
 
4848
            LEX *lex= Lex;
 
4849
            lex->command= new DefaultSelect(SQLCOM_SELECT, 
 
4850
                                            YYSession);
 
4851
            if (lex->command == NULL)
 
4852
              DRIZZLE_YYABORT;
 
4853
          }
4814
4854
        | COUNT_SYM '(' '*' ')' ERRORS
4815
 
          { (void) create_select_for_variable("error_count"); }
 
4855
          { 
 
4856
            (void) create_select_for_variable("error_count"); 
 
4857
            LEX *lex= Lex;
 
4858
            lex->command= new DefaultSelect(SQLCOM_SELECT, 
 
4859
                                            YYSession);
 
4860
            if (lex->command == NULL)
 
4861
              DRIZZLE_YYABORT;
 
4862
          }
4816
4863
        | WARNINGS opt_limit_clause_init
4817
4864
          { Lex->sql_command = SQLCOM_SHOW_WARNS;}
4818
4865
        | ERRORS opt_limit_clause_init
4821
4868
          {
4822
4869
            LEX *lex= Lex;
4823
4870
            lex->sql_command= SQLCOM_SHOW_STATUS;
 
4871
            lex->command= new ShowStatus(SQLCOM_SHOW_STATUS,
 
4872
                                         YYSession,
 
4873
                                         &LOCK_status);
 
4874
            if (lex->command == NULL)
 
4875
              DRIZZLE_YYABORT;
4824
4876
            lex->option_type= $1;
4825
4877
            if (prepare_schema_table(YYSession, lex, 0, "STATUS"))
4826
4878
              DRIZZLE_YYABORT;
4831
4883
          {
4832
4884
            LEX *lex= Lex;
4833
4885
            lex->sql_command= SQLCOM_SHOW_VARIABLES;
 
4886
            lex->command= new DefaultSelect(SQLCOM_SHOW_VARIABLES, 
 
4887
                                            YYSession);
 
4888
            if (lex->command == NULL)
 
4889
              DRIZZLE_YYABORT;
4834
4890
            lex->option_type= $1;
4835
4891
            if (prepare_schema_table(YYSession, lex, 0, "VARIABLES"))
4836
4892
              DRIZZLE_YYABORT;