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>
105
105
using namespace drizzled;
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;
2383
2383
table_list opt_checksum_type
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,
2485
if (lex->command == NULL)
2485
if (lex->statement == NULL)
2486
2486
DRIZZLE_YYABORT;
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;
4690
4690
lex->sql_command= SQLCOM_SHOW_DATABASES;
4692
4692
new(std::nothrow) statement::Select(SQLCOM_SHOW_DATABASES,
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;
4702
4702
lex->sql_command= SQLCOM_SHOW_TABLES;
4704
4704
new(std::nothrow) statement::Select(SQLCOM_SHOW_TABLES,
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"))
4715
4715
lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
4717
4717
new(std::nothrow) statement::Select(SQLCOM_SHOW_TABLE_STATUS,
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"))
4728
4728
lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
4730
4730
new(std::nothrow) statement::Select(SQLCOM_SHOW_OPEN_TABLES,
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"))
4740
4740
Lex->show_engine= $2;
4741
4741
Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS;
4743
4743
new(std::nothrow) statement::ShowEngineStatus(YYSession);
4744
if (Lex->command == NULL)
4744
if (Lex->statement == NULL)
4745
4745
DRIZZLE_YYABORT;
4747
4747
| opt_full COLUMNS from_or_in table_ident opt_db show_wild
4750
4750
lex->sql_command= SQLCOM_SHOW_FIELDS;
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;
4756
4756
$4->change_db($5);
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,
4766
if (lex->command == NULL)
4766
if (lex->statement == NULL)
4767
4767
DRIZZLE_YYABORT;
4769
4769
$3->change_db($4);
4775
4775
(void) create_select_for_variable("warning_count");
4777
lex->command= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4777
lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4779
if (lex->command == NULL)
4779
if (lex->statement == NULL)
4780
4780
DRIZZLE_YYABORT;
4782
4782
| COUNT_SYM '(' '*' ')' ERRORS
4784
4784
(void) create_select_for_variable("error_count");
4786
lex->command= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4786
lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4788
if (lex->command == NULL)
4788
if (lex->statement == NULL)
4789
4789
DRIZZLE_YYABORT;
4791
4791
| WARNINGS opt_limit_clause_init
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;
4798
4798
| ERRORS opt_limit_clause_init
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;
4805
4805
| opt_var_type STATUS_SYM show_wild
4808
4808
lex->sql_command= SQLCOM_SHOW_STATUS;
4810
4810
new(std::nothrow) statement::ShowStatus(YYSession,
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
4820
4820
Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;
4822
4822
new(std::nothrow) statement::ShowProcesslist(YYSession);
4823
if (Lex->command == NULL)
4823
if (Lex->statement == NULL)
4824
4824
DRIZZLE_YYABORT;
4826
4826
| opt_var_type VARIABLES show_wild
4829
4829
lex->sql_command= SQLCOM_SHOW_VARIABLES;
4831
4831
new(std::nothrow) statement::Select(SQLCOM_SHOW_VARIABLES,
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"))
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,
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;
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;
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;
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;