~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Siddharth Prakash Singh
  • Date: 2010-03-26 19:25:23 UTC
  • mfrom: (1410 drizzle)
  • mto: This revision was merged to the branch mainline in revision 1425.
  • Revision ID: spsneo@spsneo-laptop-20100326192523-ibjlbt1p692vobtj
merging with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1260
1260
        | ROW_FORMAT_SYM opt_equal row_types
1261
1261
          {
1262
1262
            statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
 
1263
            message::Table::TableOptions *table_options= statement->createTableMessage().mutable_options();
1263
1264
 
1264
1265
            statement->create_info.row_type= $3;
1265
1266
            statement->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT;
1266
1267
            statement->alter_info.flags.set(ALTER_ROW_FORMAT);
 
1268
 
 
1269
            switch(statement->create_info.row_type)
 
1270
            {
 
1271
            case ROW_TYPE_DEFAULT:
 
1272
              /* No use setting a default row type... just adds redundant info to message */
 
1273
              break;
 
1274
            case ROW_TYPE_FIXED:
 
1275
              table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_FIXED);
 
1276
              break;
 
1277
            case ROW_TYPE_DYNAMIC:
 
1278
              table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_DYNAMIC);
 
1279
              break;
 
1280
            case ROW_TYPE_COMPRESSED:
 
1281
              table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_COMPRESSED);
 
1282
              break;
 
1283
            case ROW_TYPE_REDUNDANT:
 
1284
              table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_REDUNDANT);
 
1285
              break;
 
1286
            case ROW_TYPE_COMPACT:
 
1287
              table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_COMPACT);
 
1288
              break;
 
1289
            case ROW_TYPE_PAGE:
 
1290
              table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_PAGE);
 
1291
              break;
 
1292
            default:
 
1293
              abort();
 
1294
            }
1267
1295
          }
1268
1296
        | default_collation
1269
1297
        | KEY_BLOCK_SIZE opt_equal ulong_num
1587
1615
              $$=DRIZZLE_TYPE_BLOB;
1588
1616
              Lex->length=(char*) 0; /* use default length */
1589
1617
 
1590
 
            statement::CreateTable *statement=
1591
 
              (statement::CreateTable *)Lex->statement;
1592
 
 
1593
 
            if (statement->current_proto_field)
1594
 
              statement->current_proto_field->set_type(message::Table::Field::BLOB);
 
1618
              statement::CreateTable *statement=
 
1619
                (statement::CreateTable *)Lex->statement;
 
1620
 
 
1621
              if (statement->current_proto_field)
 
1622
              {
 
1623
                statement->current_proto_field->set_type(message::Table::Field::BLOB);
 
1624
                message::Table::Field::StringFieldOptions *string_field_options;
 
1625
 
 
1626
                string_field_options= statement->current_proto_field->mutable_string_options();
 
1627
                string_field_options->set_collation_id(my_charset_bin.number);
 
1628
                string_field_options->set_collation(my_charset_bin.name);
 
1629
              }
1595
1630
            }
1596
1631
          | TEXT_SYM
1597
1632
            {
4707
4742
           DATABASES show_wild
4708
4743
           {
4709
4744
             LEX *lex= Lex;
 
4745
             Session *session= YYSession;
 
4746
 
4710
4747
             lex->sql_command= SQLCOM_SELECT;
4711
4748
             lex->statement=
4712
 
               new(std::nothrow) statement::Select(YYSession);
 
4749
               new(std::nothrow) statement::Select(session);
4713
4750
             if (lex->statement == NULL)
4714
4751
               DRIZZLE_YYABORT;
4715
4752
 
4716
 
             Session *session= YYSession;
4717
 
 
4718
4753
             std::string column_name= "Database";
4719
4754
             if (Lex->wild)
4720
4755
             {
4725
4760
 
4726
4761
             if (Lex->current_select->where)
4727
4762
             {
4728
 
               if (prepare_new_schema_table(YYSession, lex, "SCHEMAS"))
 
4763
               if (prepare_new_schema_table(session, lex, "SCHEMAS"))
4729
4764
                 DRIZZLE_YYABORT;
4730
4765
             }
4731
4766
             else
4732
4767
             {
4733
 
               if (prepare_new_schema_table(YYSession, lex, "SCHEMA_NAMES"))
 
4768
               if (prepare_new_schema_table(session, lex, "SCHEMA_NAMES"))
4734
4769
                 DRIZZLE_YYABORT;
4735
4770
             }
4736
4771
 
4744
4779
         | TABLES opt_db show_wild
4745
4780
           {
4746
4781
             LEX *lex= Lex;
 
4782
             Session *session= YYSession;
 
4783
 
4747
4784
             lex->sql_command= SQLCOM_SELECT;
4748
 
             lex->statement=
 
4785
 
 
4786
             statement::Select *select=
4749
4787
               new(std::nothrow) statement::Select(YYSession);
 
4788
 
 
4789
             lex->statement= select;
 
4790
 
4750
4791
             if (lex->statement == NULL)
4751
4792
               DRIZZLE_YYABORT;
4752
4793
 
4753
 
              Session *session= YYSession;
4754
4794
 
4755
4795
              std::string column_name= "Tables_in_";
4756
4796
 
4762
4802
                {
4763
4803
                  my_error(ER_BAD_DB_ERROR, MYF(0), $2);
4764
4804
                }
 
4805
                select->setShowPredicate($2, "");
4765
4806
              }
4766
 
              else
 
4807
              else if (not session->db.empty())
4767
4808
              {
4768
4809
                column_name.append(session->db);
4769
 
              }
 
4810
                select->setShowPredicate(session->db, "");
 
4811
              }
 
4812
              else
 
4813
              {
 
4814
                 my_error(ER_NO_DB_ERROR, MYF(0));
 
4815
              }
 
4816
 
4770
4817
 
4771
4818
             if (Lex->wild)
4772
4819
             {
4775
4822
               column_name.append(")");
4776
4823
             }
4777
4824
 
4778
 
             if (Lex->current_select->where)
4779
 
             {
4780
 
               if (prepare_new_schema_table(YYSession, lex, "TABLES"))
4781
 
                 DRIZZLE_YYABORT;
4782
 
             }
4783
 
             else
4784
 
             {
4785
 
               if (prepare_new_schema_table(YYSession, lex, "SHOW_TABLES"))
4786
 
                 DRIZZLE_YYABORT;
4787
 
             }
 
4825
             if (prepare_new_schema_table(YYSession, lex, "SHOW_TABLES"))
 
4826
               DRIZZLE_YYABORT;
4788
4827
 
4789
4828
             Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
4790
4829
             my_field->is_autogenerated_name= false;
4908
4947
               }
4909
4948
             }
4910
4949
 
4911
 
             if (prepare_new_schema_table(session, lex, "show_indexes"))
 
4950
             if (prepare_new_schema_table(session, lex, "SHOW_INDEXES"))
4912
4951
               DRIZZLE_YYABORT;
4913
4952
 
4914
4953
             if (session->add_item_to_list( new Item_field(&session->lex->current_select->