~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2009-04-14 01:01:44 UTC
  • mfrom: (977.1.1 disable-vcol)
  • Revision ID: brian@gaz-20090414010144-i6ra3kp7dcy0sayb
Merge vcol removal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1035
1035
        statement
1036
1036
        opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
1037
1037
        init_key_options key_options key_opts key_opt key_using_alg
1038
 
        parse_vcol_expr vcol_opt_attribute vcol_opt_attribute_list
1039
 
        vcol_attribute
1040
1038
END_OF_INPUT
1041
1039
 
1042
1040
%type <index_hint> index_hint_type
1110
1108
        | lock
1111
1109
        | optimize
1112
1110
        | keycache
1113
 
        | parse_vcol_expr
1114
1111
        | release
1115
1112
        | rename
1116
1113
        | repair
1610
1607
        ;
1611
1608
field_def:
1612
1609
          type opt_attribute {}
1613
 
        | VIRTUAL_SYM type AS '(' virtual_column_func ')' vcol_opt_attribute
1614
 
          {
1615
 
            $$=DRIZZLE_TYPE_VIRTUAL;
1616
 
            Lex->vcol_info->set_field_type((enum enum_field_types) $2);
1617
 
          }
1618
 
        ;
1619
 
 
1620
 
vcol_opt_attribute:
1621
 
          /* empty */ {}
1622
 
        | vcol_opt_attribute_list {}
1623
 
        ;
1624
 
 
1625
 
vcol_opt_attribute_list:
1626
 
          vcol_opt_attribute_list vcol_attribute {}
1627
 
        | vcol_attribute
1628
 
        ;
1629
 
 
1630
 
vcol_attribute:
1631
 
          UNIQUE_SYM
1632
 
          {
1633
 
            LEX *lex=Lex;
1634
 
            lex->type|= UNIQUE_FLAG; 
1635
 
            lex->alter_info.flags|= ALTER_ADD_INDEX;
1636
 
          }
1637
 
        | UNIQUE_SYM KEY_SYM
1638
 
          {
1639
 
            LEX *lex=Lex;
1640
 
            lex->type|= UNIQUE_KEY_FLAG; 
1641
 
            lex->alter_info.flags|= ALTER_ADD_INDEX; 
1642
 
          }
1643
 
        | COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; }
1644
 
        | STORED_SYM
1645
 
          {
1646
 
            Lex->vcol_info->set_field_stored(true);
1647
 
          }
1648
 
        ;
1649
 
 
1650
 
parse_vcol_expr:
1651
 
          PARSE_VCOL_EXPR_SYM '(' virtual_column_func ')'
1652
 
          {
1653
 
            /* 
1654
 
              "PARSE_VCOL_EXPR" can only be used by the SQL server
1655
 
              when reading a '*.frm' file.
1656
 
              Prevent the end user from invoking this command.
1657
 
            */
1658
 
            if (not Lex->parse_vcol_expr)
1659
 
            {
1660
 
              my_message(ER_SYNTAX_ERROR, ER(ER_SYNTAX_ERROR), MYF(0));
1661
 
              DRIZZLE_YYABORT;
1662
 
            }
1663
 
          }
1664
 
        ;
1665
 
 
1666
 
virtual_column_func:
1667
 
          remember_name expr remember_end
1668
 
          {
1669
 
            Lex->vcol_info= new virtual_column_info();
1670
 
            if (not Lex->vcol_info)
1671
 
            {
1672
 
              my_error(ER_OUTOFMEMORY, MYF(0), sizeof(virtual_column_info));
1673
 
              DRIZZLE_YYABORT;
1674
 
            }
1675
 
            uint32_t expr_len= (uint)($3 - $1) - 1;
1676
 
            Lex->vcol_info->expr_str.str= (char* ) sql_memdup($1 + 1, expr_len);
1677
 
            Lex->vcol_info->expr_str.length= expr_len;
1678
 
            Lex->vcol_info->expr_item= $2;
1679
 
          }
1680
1610
        ;
1681
1611
 
1682
1612
type: