~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2010-12-20 19:20:57 UTC
  • mto: This revision was merged to the branch mainline in revision 2016.
  • Revision ID: brian@tangent.org-20101220192057-1ch4b9uo008d8rje
Merge in additional fixes for sign, plus alter table, plus TIME on
processlist.

Show diffs side-by-side

added added

removed removed

Lines of Context:
699
699
%token  SET_VAR
700
700
%token  SHARE_SYM
701
701
%token  SHOW
 
702
%token  SIGNED_SYM
702
703
%token  SIMPLE_SYM                    /* SQL-2003-N */
703
704
%token  SNAPSHOT_SYM
704
705
%token  SPECIFIC_SYM                  /* SQL-2003-R */
756
757
%token  UNIQUE_SYM
757
758
%token  UNKNOWN_SYM                   /* SQL-2003-R */
758
759
%token  UNLOCK_SYM
 
760
%token  UNSIGNED_SYM
759
761
%token  UPDATE_SYM                    /* SQL-2003-R */
760
762
%token  USAGE                         /* SQL-2003-N */
761
763
%token  USER                          /* SQL-2003-R */
763
765
%token  USING                         /* SQL-2003-R */
764
766
%token  UTC_DATE_SYM
765
767
%token  UTC_TIMESTAMP_SYM
 
768
%token  UUID_SYM
766
769
%token  VALUES                        /* SQL-2003-R */
767
770
%token  VALUE_SYM                     /* SQL-2003-R */
768
771
%token  VARBINARY
783
786
%token  XOR
784
787
%token  YEAR_MONTH_SYM
785
788
%token  YEAR_SYM                      /* SQL-2003-R */
 
789
%token  ZEROFILL_SYM
786
790
 
787
791
%left   JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
788
792
/* A dummy token to force the priority of table_ref production in a join. */
834
838
        opt_status
835
839
        opt_concurrent
836
840
        opt_wait
 
841
        opt_zerofill
 
842
        opt_field_number_signed
837
843
        kill_option
838
844
 
839
845
%type <m_fk_option>
1491
1497
        ;
1492
1498
 
1493
1499
type:
1494
 
        int_type
1495
 
        {
1496
 
          $$=$1;
1497
 
          Lex->length=(char*) 0; /* use default length */
1498
 
          statement::CreateTable *statement=
1499
 
            (statement::CreateTable *)Lex->statement;
1500
 
 
1501
 
          if (statement->current_proto_field)
1502
 
          {
1503
 
            if ($1 == DRIZZLE_TYPE_LONG)
1504
 
              statement->current_proto_field->set_type(message::Table::Field::INTEGER);
1505
 
            else if ($1 == DRIZZLE_TYPE_LONGLONG)
1506
 
              statement->current_proto_field->set_type(message::Table::Field::BIGINT);
1507
 
            else
1508
 
              abort();
1509
 
          }
 
1500
          int_type ignored_field_number_length opt_field_number_signed opt_zerofill
 
1501
          { 
 
1502
            $$= $1;
 
1503
            Lex->length=(char*) 0; /* use default length */
 
1504
            statement::CreateTable *statement=
 
1505
              (statement::CreateTable *)Lex->statement;
 
1506
 
 
1507
            if ($3 or $4)
 
1508
            {
 
1509
              $1= DRIZZLE_TYPE_LONGLONG;
 
1510
            }
 
1511
 
 
1512
            if (statement->current_proto_field)
 
1513
            {
 
1514
              assert ($1 == DRIZZLE_TYPE_LONG or $1 == DRIZZLE_TYPE_LONGLONG);
 
1515
              // We update the type for unsigned types
 
1516
              if ($3 or $4)
 
1517
              {
 
1518
                statement->current_proto_field->set_type(message::Table::Field::BIGINT);
 
1519
                statement->current_proto_field->mutable_constraints()->set_is_unsigned(true);
 
1520
              }
 
1521
              if ($1 == DRIZZLE_TYPE_LONG)
 
1522
              {
 
1523
                statement->current_proto_field->set_type(message::Table::Field::INTEGER);
 
1524
              }
 
1525
              else if ($1 == DRIZZLE_TYPE_LONGLONG)
 
1526
              {
 
1527
                statement->current_proto_field->set_type(message::Table::Field::BIGINT);
 
1528
              }
 
1529
            }
1510
1530
          }
1511
1531
        | real_type opt_precision
1512
1532
          {
1692
1712
            if (statement->current_proto_field)
1693
1713
              statement->current_proto_field->set_type(message::Table::Field::ENUM);
1694
1714
          }
 
1715
          | UUID_SYM
 
1716
          {
 
1717
            $$=DRIZZLE_TYPE_UUID;
 
1718
 
 
1719
            statement::CreateTable *statement=
 
1720
              (statement::CreateTable *)Lex->statement;
 
1721
 
 
1722
            if (statement->current_proto_field)
 
1723
              statement->current_proto_field->set_type(message::Table::Field::UUID);
 
1724
          }
1695
1725
        | SERIAL_SYM
1696
1726
          {
1697
1727
            $$=DRIZZLE_TYPE_LONGLONG;
1757
1787
        | '(' NUM ')' { Lex->length= $2.str; }
1758
1788
        ;
1759
1789
 
 
1790
opt_field_number_signed:
 
1791
          /* empty */ { $$= 0; }
 
1792
        | SIGNED_SYM { $$= 0; }
 
1793
        | UNSIGNED_SYM { $$= 1; Lex->type|= UNSIGNED_FLAG; }
 
1794
        ;
 
1795
 
 
1796
ignored_field_number_length:
 
1797
          /* empty */ { }
 
1798
        | '(' NUM ')' { }
 
1799
        ;
 
1800
 
 
1801
opt_zerofill:
 
1802
          /* empty */ { $$= 0; }
 
1803
        | ZEROFILL_SYM { $$= 1; Lex->type|= UNSIGNED_FLAG; }
 
1804
        ;
 
1805
 
1760
1806
opt_precision:
1761
1807
          /* empty */ {}
1762
1808
        | precision {}
3319
3365
              DRIZZLE_YYABORT;
3320
3366
            }
3321
3367
          }
 
3368
        | UUID_SYM '(' ')'
 
3369
          {
 
3370
            if (! ($$= reserved_keyword_function(YYSession, "uuid", NULL)))
 
3371
            {
 
3372
              DRIZZLE_YYABORT;
 
3373
            }
 
3374
            Lex->setCacheable(false);
 
3375
          }
3322
3376
        | WAIT_SYM '(' expr ',' expr ')'
3323
3377
          {
3324
3378
            std::string wait_str("wait");