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/empty_query.h>
94
#include <drizzled/command/load.h>
95
#include <drizzled/command/rollback.h>
96
#include <drizzled/command/select.h>
97
#include <drizzled/command/show_create.h>
98
#include <drizzled/command/show_engine_status.h>
99
#include <drizzled/command/show_errors.h>
100
#include <drizzled/command/show_processlist.h>
101
#include <drizzled/command/show_status.h>
102
#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_create_schema.h>
100
#include <drizzled/statement/show_engine_status.h>
101
#include <drizzled/statement/show_errors.h>
102
#include <drizzled/statement/show_processlist.h>
103
#include <drizzled/statement/show_status.h>
104
#include <drizzled/statement/show_warnings.h>
105
#include <drizzled/statement/unlock_tables.h>
104
107
using namespace drizzled;
1077
1080
session->lex->sql_command= SQLCOM_EMPTY_QUERY;
1078
session->lex->command=
1079
new(std::nothrow) command::EmptyQuery(SQLCOM_EMPTY_QUERY,
1081
if (session->lex->command == NULL)
1081
session->lex->statement=
1082
new(std::nothrow) statement::EmptyQuery(YYSession);
1083
if (session->lex->statement == NULL)
1082
1084
DRIZZLE_YYABORT;
2378
2380
lex->sql_command = SQLCOM_CHECKSUM;
2379
lex->command= new(std::nothrow) command::Checksum(SQLCOM_CHECKSUM,
2381
if (lex->command == NULL)
2381
lex->statement= new(std::nothrow) statement::Checksum(YYSession);
2382
if (lex->statement == NULL)
2382
2383
DRIZZLE_YYABORT;
2384
2385
table_list opt_checksum_type
2483
2484
lex->sql_command= SQLCOM_SELECT;
2484
lex->command= new(std::nothrow) command::Select(SQLCOM_SELECT,
2485
lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
2486
if (lex->command == NULL)
2487
if (lex->statement == NULL)
2487
2488
DRIZZLE_YYABORT;
4688
4692
lex->sql_command= SQLCOM_SHOW_DATABASES;
4690
new(std::nothrow) command::Select(SQLCOM_SHOW_DATABASES,
4694
new(std::nothrow) statement::Select(SQLCOM_SHOW_DATABASES,
4692
if (lex->command == NULL)
4696
if (lex->statement == NULL)
4693
4697
DRIZZLE_YYABORT;
4694
4698
if (prepare_schema_table(YYSession, lex, 0, "SCHEMATA"))
4695
4699
DRIZZLE_YYABORT;
4700
4704
lex->sql_command= SQLCOM_SHOW_TABLES;
4702
new(std::nothrow) command::Select(SQLCOM_SHOW_TABLES,
4706
new(std::nothrow) statement::Select(SQLCOM_SHOW_TABLES,
4704
if (lex->command == NULL)
4708
if (lex->statement == NULL)
4705
4709
DRIZZLE_YYABORT;
4706
4710
lex->select_lex.db= $3;
4707
4711
if (prepare_schema_table(YYSession, lex, 0, "TABLE_NAMES"))
4713
4717
lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
4715
new(std::nothrow) command::Select(SQLCOM_SHOW_TABLE_STATUS,
4719
new(std::nothrow) statement::Select(SQLCOM_SHOW_TABLE_STATUS,
4717
if (lex->command == NULL)
4721
if (lex->statement == NULL)
4718
4722
DRIZZLE_YYABORT;
4719
4723
lex->select_lex.db= $3;
4720
4724
if (prepare_schema_table(YYSession, lex, 0, "TABLES"))
4726
4730
lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
4728
new(std::nothrow) command::Select(SQLCOM_SHOW_OPEN_TABLES,
4732
new(std::nothrow) statement::Select(SQLCOM_SHOW_OPEN_TABLES,
4730
if (lex->command == NULL)
4734
if (lex->statement == NULL)
4731
4735
DRIZZLE_YYABORT;
4732
4736
lex->select_lex.db= $3;
4733
4737
if (prepare_schema_table(YYSession, lex, 0, "OPEN_TABLES"))
4738
4742
Lex->show_engine= $2;
4739
4743
Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS;
4741
new(std::nothrow) command::ShowEngineStatus(SQLCOM_SHOW_ENGINE_STATUS,
4743
if (Lex->command == NULL)
4745
new(std::nothrow) statement::ShowEngineStatus(YYSession);
4746
if (Lex->statement == NULL)
4744
4747
DRIZZLE_YYABORT;
4746
4749
| opt_full COLUMNS from_or_in table_ident opt_db show_wild
4749
4752
lex->sql_command= SQLCOM_SHOW_FIELDS;
4751
new(std::nothrow) command::Select(SQLCOM_SHOW_FIELDS, YYSession);
4752
if (lex->command == NULL)
4754
new(std::nothrow) statement::Select(SQLCOM_SHOW_FIELDS, YYSession);
4755
if (lex->statement == NULL)
4753
4756
DRIZZLE_YYABORT;
4755
4758
$4->change_db($5);
4762
4765
lex->sql_command= SQLCOM_SHOW_KEYS;
4763
lex->command= new(std::nothrow) command::Select(SQLCOM_SHOW_KEYS,
4766
lex->statement= new(std::nothrow) statement::Select(SQLCOM_SHOW_KEYS,
4765
if (lex->command == NULL)
4768
if (lex->statement == NULL)
4766
4769
DRIZZLE_YYABORT;
4768
4771
$3->change_db($4);
4774
4777
(void) create_select_for_variable("warning_count");
4776
lex->command= new(std::nothrow) command::Select(SQLCOM_SELECT,
4779
lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4778
if (lex->command == NULL)
4781
if (lex->statement == NULL)
4779
4782
DRIZZLE_YYABORT;
4781
4784
| COUNT_SYM '(' '*' ')' ERRORS
4783
4786
(void) create_select_for_variable("error_count");
4785
lex->command= new(std::nothrow) command::Select(SQLCOM_SELECT,
4788
lex->statement= new(std::nothrow) statement::Select(SQLCOM_SELECT,
4787
if (lex->command == NULL)
4790
if (lex->statement == NULL)
4788
4791
DRIZZLE_YYABORT;
4790
4793
| WARNINGS opt_limit_clause_init
4792
4795
Lex->sql_command = SQLCOM_SHOW_WARNS;
4793
Lex->command= new(std::nothrow) command::ShowWarnings(SQLCOM_SHOW_WARNS,
4795
if (Lex->command == NULL)
4796
Lex->statement= new(std::nothrow) statement::ShowWarnings(YYSession);
4797
if (Lex->statement == NULL)
4796
4798
DRIZZLE_YYABORT;
4798
4800
| ERRORS opt_limit_clause_init
4800
4802
Lex->sql_command = SQLCOM_SHOW_ERRORS;
4801
Lex->command= new(std::nothrow) command::ShowErrors(SQLCOM_SHOW_ERRORS,
4803
if (Lex->command == NULL)
4803
Lex->statement= new(std::nothrow) statement::ShowErrors(YYSession);
4804
if (Lex->statement == NULL)
4804
4805
DRIZZLE_YYABORT;
4806
4807
| opt_var_type STATUS_SYM show_wild
4809
4810
lex->sql_command= SQLCOM_SHOW_STATUS;
4811
new(std::nothrow) command::ShowStatus(SQLCOM_SHOW_STATUS,
4812
new(std::nothrow) statement::ShowStatus(YYSession,
4814
if (lex->command == NULL)
4814
if (lex->statement == NULL)
4815
4815
DRIZZLE_YYABORT;
4816
4816
lex->option_type= $1;
4817
4817
if (prepare_schema_table(YYSession, lex, 0, "STATUS"))
4820
4820
| opt_full PROCESSLIST_SYM
4822
4822
Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;
4824
new(std::nothrow) command::ShowProcesslist(SQLCOM_SHOW_PROCESSLIST,
4826
if (Lex->command == NULL)
4824
new(std::nothrow) statement::ShowProcesslist(YYSession);
4825
if (Lex->statement == NULL)
4827
4826
DRIZZLE_YYABORT;
4829
4828
| opt_var_type VARIABLES show_wild
4832
4831
lex->sql_command= SQLCOM_SHOW_VARIABLES;
4834
new(std::nothrow) command::Select(SQLCOM_SHOW_VARIABLES,
4833
new(std::nothrow) statement::Select(SQLCOM_SHOW_VARIABLES,
4836
if (lex->command == NULL)
4835
if (lex->statement == NULL)
4837
4836
DRIZZLE_YYABORT;
4838
4837
lex->option_type= $1;
4839
4838
if (prepare_schema_table(YYSession, lex, 0, "VARIABLES"))
4842
4841
| CREATE DATABASE opt_if_not_exists ident
4844
4843
Lex->sql_command=SQLCOM_SHOW_CREATE_DB;
4844
Lex->statement= new(std::nothrow) statement::ShowCreateSchema(YYSession);
4845
if (Lex->statement == NULL)
4845
4847
Lex->create_info.options=$3;
4851
4853
lex->sql_command = SQLCOM_SHOW_CREATE;
4852
lex->command= new(std::nothrow) command::ShowCreate(SQLCOM_SHOW_CREATE,
4854
if (lex->command == NULL)
4854
lex->statement= new(std::nothrow) statement::ShowCreate(YYSession);
4855
if (lex->statement == NULL)
4855
4856
DRIZZLE_YYABORT;
4856
4857
if (!lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
4857
4858
DRIZZLE_YYABORT;
4898
4899
mysql_init_select(lex);
4899
4900
lex->current_select->parsing_place= SELECT_LIST;
4900
4901
lex->sql_command= SQLCOM_SHOW_FIELDS;
4901
lex->command= new(std::nothrow) command::Select(SQLCOM_SHOW_FIELDS,
4902
lex->statement= new(std::nothrow) statement::Select(SQLCOM_SHOW_FIELDS,
4903
if (lex->command == NULL)
4904
if (lex->statement == NULL)
4904
4905
DRIZZLE_YYABORT;
4905
4906
lex->select_lex.db= 0;
4906
4907
lex->verbose= 0;
5020
5021
lex->sql_command= SQLCOM_LOAD;
5021
lex->command= new(std::nothrow) command::Load(SQLCOM_LOAD,
5023
if (lex->command == NULL)
5022
lex->statement= new(std::nothrow) statement::Load(YYSession);
5023
if (lex->statement == NULL)
5024
5024
DRIZZLE_YYABORT;
5025
5025
lex->lock_option= $4;
5026
5026
lex->duplicates= DUP_ERROR;
5895
5898
lex->sql_command= SQLCOM_COMMIT;
5896
lex->command= new(std::nothrow) command::Commit(SQLCOM_COMMIT,
5898
if (lex->command == NULL)
5899
lex->statement= new(std::nothrow) statement::Commit(YYSession);
5900
if (lex->statement == NULL)
5899
5901
DRIZZLE_YYABORT;
5900
5902
lex->tx_chain= $3;
5901
5903
lex->tx_release= $4;
5909
5911
lex->sql_command= SQLCOM_ROLLBACK;
5910
lex->command= new(std::nothrow) command::Rollback(SQLCOM_ROLLBACK,
5912
if (lex->command == NULL)
5912
lex->statement= new(std::nothrow) statement::Rollback(YYSession);
5913
if (lex->statement == NULL)
5913
5914
DRIZZLE_YYABORT;
5914
5915
lex->tx_chain= $3;
5915
5916
lex->tx_release= $4;