12
12
You should have received a copy of the GNU General Public License
13
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
1989
1993
| CASCADE { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_CASCADE; }
1990
1994
| SET NULL_SYM { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_SET_NULL; }
1991
1995
| NO_SYM ACTION { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_NO_ACTION; }
1992
| SET DEFAULT { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_DEFAULT; }
1996
| SET DEFAULT { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_SET_DEFAULT; }
2121
2125
DRIZZLE_YYABORT;
2122
2126
lex->col_list.empty();
2123
2127
lex->select_lex.init_order();
2125
((TableList*) lex->select_lex.table_list.first)->db;
2128
lex->select_lex.db= const_cast<char *>(((TableList*) lex->select_lex.table_list.first)->getSchemaName());
2126
2129
statement->alter_info.build_method= $2;
3719
3722
/* Warning - may return NULL in case of incomplete SELECT */
3722
Select_Lex *sel= Lex->current_select;
3723
sel->table_join_options= 0;
3725
3726
table_ident opt_table_alias opt_key_definition
3727
3728
if (!($$= Lex->current_select->add_table_to_list(YYSession, $2, $3,
3728
Lex->current_select->get_table_join_options(),
3729
3730
Lex->lock_option,
3730
3731
Lex->current_select->pop_index_hints())))
3731
3732
DRIZZLE_YYABORT;
4462
4463
/* empty */ { $$= 0; }
4463
4464
| TEMPORARY_SYM { $$= 1; }
4468
Execute a string as dynamic SQL.
4472
EXECUTE_SYM execute_var_or_string
4477
execute_var_or_string:
4481
statement::Execute *statement= new(std::nothrow) statement::Execute(YYSession);
4482
lex->statement= statement;
4483
if (lex->statement == NULL)
4486
statement->setQuery($1);
4491
statement::Execute *statement= new(std::nothrow) statement::Execute(YYSession);
4492
lex->statement= statement;
4493
if (lex->statement == NULL)
4496
statement->setVar();
4497
statement->setQuery($2);
4466
4501
** Insert : add new data to table
4887
4925
(session->lex->current_select->with_wild)++;
4928
/* SHOW TABLE STATUS */
4890
4929
| TABLE_SYM STATUS_SYM opt_db show_wild
4893
4932
lex->sql_command= SQLCOM_SELECT;
4894
statement::Select *select=
4895
new(std::nothrow) statement::Select(YYSession);
4933
statement::Show *select=
4934
new(std::nothrow) statement::Show(YYSession);
4897
4936
lex->statement= select;
4929
4968
DRIZZLE_YYABORT;
4930
4969
(session->lex->current_select->with_wild)++;
4971
/* SHOW COLUMNS FROM table_name */
4932
4972
| COLUMNS from_or_in table_ident opt_db show_wild
4935
4975
Session *session= YYSession;
4936
statement::Select *select;
4976
statement::Show *select;
4938
4978
lex->sql_command= SQLCOM_SELECT;
4940
select= new(std::nothrow) statement::Select(session);
4980
select= new(std::nothrow) statement::Show(session);
4942
4982
lex->statement= select;
4971
5011
(session->lex->current_select->with_wild)++;
5014
/* SHOW INDEXES from table */
4974
5015
| keys_or_index from_or_in table_ident opt_db where_clause
4977
5018
Session *session= YYSession;
4978
statement::Select *select;
5019
statement::Show *select;
4980
5021
lex->sql_command= SQLCOM_SELECT;
4982
select= new(std::nothrow) statement::Select(session);
5023
select= new(std::nothrow) statement::Show(session);
4984
5025
lex->statement= select;
5017
5058
(void) create_select_for_variable("warning_count");
5019
lex->statement= new(std::nothrow) statement::Select(YYSession);
5060
lex->statement= new(std::nothrow) statement::Show(YYSession);
5020
5061
if (lex->statement == NULL)
5021
5062
DRIZZLE_YYABORT;
5025
5066
(void) create_select_for_variable("error_count");
5027
lex->statement= new(std::nothrow) statement::Select(YYSession);
5068
lex->statement= new(std::nothrow) statement::Show(YYSession);
5028
5069
if (lex->statement == NULL)
5029
5070
DRIZZLE_YYABORT;
5081
5122
if (session->add_item_to_list(my_field))
5082
5123
DRIZZLE_YYABORT;
5125
| CREATE TABLE_SYM table_ident
5128
lex->sql_command= SQLCOM_SELECT;
5129
statement::Show *select=
5130
new(std::nothrow) statement::Show(YYSession);
5132
lex->statement= select;
5134
if (lex->statement == NULL)
5137
Session *session= YYSession;
5139
if (prepare_new_schema_table(session, lex, "TABLE_SQL_DEFINITION"))
5143
select->setShowPredicate($3->db.str, $3->table.str);
5145
select->setShowPredicate(session->db, $3->table.str);
5147
std::string key("Table");
5148
std::string value("Create Table");
5150
Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
5151
my_field->is_autogenerated_name= false;
5152
my_field->set_name(key.c_str(), key.length(), system_charset_info);
5154
if (session->add_item_to_list(my_field))
5157
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_SQL_DEFINITION");
5158
my_field->is_autogenerated_name= false;
5159
my_field->set_name(value.c_str(), value.length(), system_charset_info);
5161
if (session->add_item_to_list(my_field))
5084
5164
| PROCESSLIST_SYM
5088
5168
lex->sql_command= SQLCOM_SELECT;
5089
5169
lex->statement=
5090
new(std::nothrow) statement::Select(YYSession);
5170
new(std::nothrow) statement::Show(YYSession);
5091
5171
if (lex->statement == NULL)
5092
5172
DRIZZLE_YYABORT;
5143
5223
DRIZZLE_YYABORT;
5145
5225
| CREATE DATABASE opt_if_not_exists ident
5147
Lex->sql_command=SQLCOM_SHOW_CREATE_DB;
5148
statement::ShowCreateSchema *statement= new(std::nothrow) statement::ShowCreateSchema(YYSession);
5149
Lex->statement= statement;
5150
if (Lex->statement == NULL)
5152
statement->is_if_not_exists= $3;
5155
| CREATE TABLE_SYM table_ident
5158
lex->sql_command = SQLCOM_SHOW_CREATE;
5159
lex->statement= new(std::nothrow) statement::ShowCreate(YYSession);
5160
if (lex->statement == NULL)
5162
if (!lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
5228
lex->sql_command= SQLCOM_SELECT;
5229
statement::Show *select=
5230
new(std::nothrow) statement::Show(YYSession);
5232
lex->statement= select;
5234
if (lex->statement == NULL)
5237
Session *session= YYSession;
5239
if (prepare_new_schema_table(session, lex, "SCHEMA_SQL_DEFINITION"))
5243
select->setShowPredicate($4.str);
5245
select->setShowPredicate(session->db);
5247
std::string key("Database");
5248
std::string value("Create Database");
5250
Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_NAME");
5251
my_field->is_autogenerated_name= false;
5252
my_field->set_name(key.c_str(), key.length(), system_charset_info);
5254
if (session->add_item_to_list(my_field))
5257
my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_SQL_DEFINITION");
5258
my_field->is_autogenerated_name= false;
5259
my_field->set_name(value.c_str(), value.length(), system_charset_info);
5261
if (session->add_item_to_list(my_field))
5167
5266
/* empty */ { $$= 0; }
5195
5294
describe_command table_ident
5197
5296
Session *session= YYSession;
5198
statement::Select *select;
5297
statement::Show *select;
5200
5299
lex->lock_option= TL_READ;
5201
5300
mysql_init_select(lex);
5202
5301
lex->current_select->parsing_place= SELECT_LIST;
5203
5302
lex->sql_command= SQLCOM_SELECT;
5204
select= new(std::nothrow) statement::Select(session);
5303
select= new(std::nothrow) statement::Show(session);
5205
5304
lex->statement= select;
5206
5305
if (lex->statement == NULL)
5207
5306
DRIZZLE_YYABORT;
5732
5831
TableList *table=
5733
5832
reinterpret_cast<TableList*>(Lex->current_select->table_list.first);
5734
if (my_strcasecmp(table_alias_charset, $1.str, table->db))
5833
if (my_strcasecmp(table_alias_charset, $1.str, table->getSchemaName()))
5736
5835
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
5737
5836
DRIZZLE_YYABORT;
5739
5838
if (my_strcasecmp(table_alias_charset, $3.str,
5839
table->getTableName()))
5742
5841
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str);
5743
5842
DRIZZLE_YYABORT;