~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2011-01-21 00:34:32 UTC
  • mto: This revision was merged to the branch mainline in revision 2102.
  • Revision ID: brian@tangent.org-20110121003432-3219wo0plu557niy
Move show create schema into function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5229
5229
               DRIZZLE_YYABORT;
5230
5230
           }
5231
5231
        | CREATE DATABASE opt_if_not_exists ident
5232
 
           {
5233
 
             Lex->sql_command= SQLCOM_SELECT;
5234
 
             drizzled::statement::Show *select= new statement::Show(YYSession);
5235
 
             Lex->statement= select;
5236
 
 
5237
 
             if (prepare_new_schema_table(YYSession, Lex, "SCHEMA_SQL_DEFINITION"))
5238
 
               DRIZZLE_YYABORT;
5239
 
 
5240
 
             util::string::const_shared_ptr schema(YYSession->schema());
5241
 
             if ($4.str)
5242
 
             {
5243
 
              select->setShowPredicate($4.str);
5244
 
             }
5245
 
             else if (schema)
5246
 
             {
5247
 
               select->setShowPredicate(*schema);
5248
 
             }
5249
 
             else
5250
 
             {
5251
 
               my_error(ER_NO_DB_ERROR, MYF(0));
5252
 
               DRIZZLE_YYABORT;
5253
 
             }
5254
 
 
5255
 
             std::string key("Database");
5256
 
             std::string value("Create Database");
5257
 
 
5258
 
             Item_field *my_field= new Item_field(&YYSession->lex->current_select->context, NULL, NULL, "SCHEMA_NAME");
5259
 
             my_field->is_autogenerated_name= false;
5260
 
             my_field->set_name(key.c_str(), key.length(), system_charset_info);
5261
 
 
5262
 
             if (YYSession->add_item_to_list(my_field))
5263
 
               DRIZZLE_YYABORT;
5264
 
 
5265
 
             my_field= new Item_field(&YYSession->lex->current_select->context, NULL, NULL, "SCHEMA_SQL_DEFINITION");
5266
 
             my_field->is_autogenerated_name= false;
5267
 
             my_field->set_name(value.c_str(), value.length(), system_charset_info);
5268
 
 
5269
 
             if (YYSession->add_item_to_list(my_field))
5270
 
               DRIZZLE_YYABORT;
5271
 
           }
 
5232
          {
 
5233
            if (not show::buildCreateSchema(YYSession, $4))
 
5234
            {
 
5235
              DRIZZLE_YYABORT;
 
5236
            }
 
5237
          }
5272
5238
 
5273
5239
opt_db:
5274
5240
          /* empty */  { $$= 0; }