~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2010-10-09 00:49:33 UTC
  • mfrom: (1812.5.8 staging)
  • Revision ID: brian@tangent.org-20101009004933-tehugnkubtzp6uy4
Merge in changes for show create table.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5081
5081
             if (session->add_item_to_list(my_field))
5082
5082
               DRIZZLE_YYABORT;
5083
5083
           }
 
5084
        | CREATE TABLE_SYM table_ident
 
5085
           {
 
5086
             LEX *lex= Lex;
 
5087
             lex->sql_command= SQLCOM_SELECT;
 
5088
             statement::Select *select=
 
5089
               new(std::nothrow) statement::Select(YYSession);
 
5090
 
 
5091
             lex->statement= select;
 
5092
 
 
5093
             if (lex->statement == NULL)
 
5094
               DRIZZLE_YYABORT;
 
5095
 
 
5096
             Session *session= YYSession;
 
5097
 
 
5098
             if (prepare_new_schema_table(session, lex, "TABLE_SQL_DEFINITION"))
 
5099
               DRIZZLE_YYABORT;
 
5100
 
 
5101
             if ($3->db.str)
 
5102
              select->setShowPredicate($3->db.str, $3->table.str);
 
5103
             else
 
5104
              select->setShowPredicate(session->db, $3->table.str);
 
5105
 
 
5106
             std::string key("Table");
 
5107
             std::string value("Create Table");
 
5108
 
 
5109
             Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
 
5110
             my_field->is_autogenerated_name= false;
 
5111
             my_field->set_name(key.c_str(), key.length(), system_charset_info);
 
5112
 
 
5113
             if (session->add_item_to_list(my_field))
 
5114
               DRIZZLE_YYABORT;
 
5115
 
 
5116
             my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_SQL_DEFINITION");
 
5117
             my_field->is_autogenerated_name= false;
 
5118
             my_field->set_name(value.c_str(), value.length(), system_charset_info);
 
5119
 
 
5120
             if (session->add_item_to_list(my_field))
 
5121
               DRIZZLE_YYABORT;
 
5122
           }
5084
5123
        | PROCESSLIST_SYM
5085
5124
          {
5086
5125
           {
5152
5191
            statement->is_if_not_exists= $3;
5153
5192
            Lex->name= $4;
5154
5193
          }
5155
 
        | CREATE TABLE_SYM table_ident
5156
 
          {
5157
 
            LEX *lex= Lex;
5158
 
            lex->sql_command = SQLCOM_SHOW_CREATE;
5159
 
            lex->statement= new(std::nothrow) statement::ShowCreate(YYSession);
5160
 
            if (lex->statement == NULL)
5161
 
              DRIZZLE_YYABORT;
5162
 
            if (!lex->select_lex.add_table_to_list(YYSession, $3, NULL,0))
5163
 
              DRIZZLE_YYABORT;
5164
 
          }
5165
5194
 
5166
5195
opt_db:
5167
5196
          /* empty */  { $$= 0; }