~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2011-01-02 01:16:35 UTC
  • mto: (2060.2.1 clean)
  • mto: This revision was merged to the branch mainline in revision 2063.
  • Revision ID: brian@tangent.org-20110102011635-pz2ddvj684xq9d5k
Merge in change to use row_format spefically *this is backward compatible
stuff).

Show diffs side-by-side

added added

removed removed

Lines of Context:
392
392
  Currently there are 88 shift/reduce conflicts.
393
393
  We should not introduce new conflicts any more.
394
394
*/
395
 
%expect 95
 
395
%expect 97
396
396
 
397
397
/*
398
398
   Comments for TOKENS.
442
442
%token  BOTH                          /* SQL-2003-R */
443
443
%token  BTREE_SYM
444
444
%token  BY                            /* SQL-2003-R */
445
 
%token  BYTE_SYM
446
445
%token  CALL_SYM                      /* SQL-2003-R */
447
446
%token  CASCADE                       /* SQL-2003-N */
448
447
%token  CASCADED                      /* SQL-2003-R */
812
811
%type <lex_str>
813
812
        IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
814
813
        LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
815
 
        ident_or_text_or_hostname
 
814
        ident_or_text_or_keyword
 
815
        row_format_or_text
 
816
        ident_or_text_or_keyword_or_hostname
816
817
        IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
817
818
        opt_component
818
819
        BIN_NUM TEXT_STRING_filesystem
924
925
 
925
926
%type <cast_type> cast_type
926
927
 
927
 
%type <symbol> keyword keyword_sp
 
928
%type <symbol>
 
929
        keyword
 
930
        keyword_sp
 
931
        row_format
928
932
 
929
933
%type <charset>
930
934
        collation_name
1103
1107
            statement->alter_info.key_list.push_back(key);
1104
1108
            Lex->col_list.empty();
1105
1109
          }
1106
 
        | CREATE DATABASE opt_if_not_exists ident
 
1110
        | CREATE DATABASE opt_if_not_exists IDENT_sys
1107
1111
          {
1108
1112
            Lex->sql_command=SQLCOM_CREATE_DB;
1109
1113
            Lex->statement= new statement::CreateSchema(YYSession);
1271
1275
          custom_engine_option;
1272
1276
 
1273
1277
custom_engine_option:
1274
 
        ENGINE_SYM equal ident_or_text
 
1278
        ENGINE_SYM equal ident_or_text_or_keyword
1275
1279
          {
1276
1280
            Lex->table()->mutable_engine()->set_name($3.str);
1277
1281
          }
1283
1287
          {
1284
1288
            Lex->table()->mutable_options()->set_auto_increment_value($3);
1285
1289
          }
1286
 
        |  ident_or_text equal ident_or_text
 
1290
        |  ROW_FORMAT_SYM equal row_format_or_text
 
1291
          {
 
1292
            drizzled::message::Engine::Option *opt= Lex->table()->mutable_engine()->add_options();
 
1293
 
 
1294
            opt->set_name("ROW_FORMAT");
 
1295
            opt->set_state($3.str);
 
1296
          }
 
1297
        |  ident_or_text_or_keyword equal ident_or_text_or_keyword
1287
1298
          {
1288
1299
            drizzled::message::Engine::Option *opt= Lex->table()->mutable_engine()->add_options();
1289
1300
 
1290
1301
            opt->set_name($1.str);
1291
1302
            opt->set_state($3.str);
1292
1303
          }
1293
 
        | ident_or_text equal ulonglong_num
 
1304
        | ident_or_text_or_keyword equal ulonglong_num
1294
1305
          {
1295
1306
            char number_as_string[22];
1296
1307
            snprintf(number_as_string, sizeof(number_as_string), "%"PRIu64, $3);
1331
1342
          }
1332
1343
        ;
1333
1344
 
 
1345
row_format:
 
1346
          COMPACT_SYM  {}
 
1347
        | COMPRESSED_SYM  {}
 
1348
        | DEFAULT  {}
 
1349
        | DYNAMIC_SYM  {}
 
1350
        | FIXED_SYM  {}
 
1351
        | REDUNDANT_SYM  {}
 
1352
        ;
 
1353
 
 
1354
row_format_or_text:
 
1355
          TEXT_STRING_sys { $$=$1; }
 
1356
        | row_format
 
1357
          {
 
1358
            $$.str= YYSession->strmake($1.str, $1.length);
 
1359
            $$.length= $1.length;
 
1360
          }
 
1361
        ;
 
1362
 
1334
1363
column_format_types:
1335
1364
          DEFAULT     { $$= COLUMN_FORMAT_TYPE_DEFAULT; }
1336
1365
        | FIXED_SYM   { $$= COLUMN_FORMAT_TYPE_FIXED; }
2097
2126
          }
2098
2127
          alter_commands
2099
2128
          {}
2100
 
        | ALTER DATABASE ident
 
2129
        | ALTER DATABASE IDENT_sys
2101
2130
          {
2102
2131
            Lex->sql_command=SQLCOM_ALTER_DB;
2103
2132
            Lex->statement= new statement::AlterSchema(YYSession);
3414
3443
        ;
3415
3444
 
3416
3445
variable_aux:
3417
 
          ident_or_text_or_hostname SET_VAR expr
 
3446
          ident_or_text_or_keyword_or_hostname SET_VAR expr
3418
3447
          {
3419
3448
            $$= new Item_func_set_user_var($1, $3);
3420
3449
            Lex->setCacheable(false);
3421
3450
          }
3422
 
        | ident_or_text_or_hostname
 
3451
        | ident_or_text_or_keyword_or_hostname
3423
3452
          {
3424
3453
            $$= new Item_func_get_user_var(*YYSession, $1);
3425
3454
            Lex->setCacheable(false);
3426
3455
          }
3427
 
        | '@' opt_var_ident_type ident_or_text_or_hostname opt_component
 
3456
        | '@' opt_var_ident_type ident_or_text_or_keyword_or_hostname opt_component
3428
3457
          {
3429
3458
            /* disallow "SELECT @@global.global.variable" */
3430
3459
            if ($3.str && $4.str && check_reserved_words(&$3))
4353
4382
        ;
4354
4383
 
4355
4384
select_var_ident: 
4356
 
          '@' ident_or_text_or_hostname
 
4385
          '@' ident_or_text_or_keyword_or_hostname
4357
4386
          {
4358
4387
            if (Lex->result)
4359
4388
              ((select_dumpvar *)Lex->result)->var_list.push_back( new var($2,0,0,(enum_field_types)0));
4421
4450
                                                          TL_OPTION_UPDATING))
4422
4451
              DRIZZLE_YYABORT;
4423
4452
          }
4424
 
        | DROP DATABASE if_exists ident
 
4453
        | DROP DATABASE if_exists IDENT_sys
4425
4454
          {
4426
4455
            Lex->sql_command= SQLCOM_DROP_DB;
4427
4456
            statement::DropSchema *statement= new statement::DropSchema(YYSession);
4464
4493
 
4465
4494
 
4466
4495
execute_var_or_string:
4467
 
         ident_or_text_or_hostname
 
4496
         ident_or_text_or_keyword_or_hostname
4468
4497
         {
4469
4498
            $$.set($1);
4470
4499
         }
4471
 
        | '@' ident_or_text_or_hostname
 
4500
        | '@' ident_or_text_or_keyword_or_hostname
4472
4501
        {
4473
4502
            $$.set($2, true);
4474
4503
        }
5546
5575
 
5547
5576
field_or_var:
5548
5577
          simple_ident_nospvar {$$= $1;}
5549
 
        | '@' ident_or_text_or_hostname
 
5578
        | '@' ident_or_text_or_keyword_or_hostname
5550
5579
          { $$= new Item_user_var_as_out_param($2); }
5551
5580
        ;
5552
5581
 
5797
5826
 
5798
5827
table_ident:
5799
5828
          ident { $$=new Table_ident($1); }
5800
 
        | ident '.' ident { $$=new Table_ident($1,$3);}
 
5829
        | IDENT_sys '.' ident { $$=new Table_ident($1,$3);}
5801
5830
        | '.' ident { $$=new Table_ident($2);} /* For Delphi */
5802
5831
        ;
5803
5832
 
5851
5880
        ;
5852
5881
 
5853
5882
ident_or_text:
 
5883
          IDENT_sys           { $$=$1;}
 
5884
        | TEXT_STRING_sys { $$=$1;}
 
5885
        ;
 
5886
 
 
5887
ident_or_text_or_keyword:
5854
5888
          ident           { $$=$1;}
5855
5889
        | TEXT_STRING_sys { $$=$1;}
5856
5890
        ;
5857
5891
 
5858
 
ident_or_text_or_hostname:
 
5892
ident_or_text_or_keyword_or_hostname:
5859
5893
          ident           { $$=$1;}
5860
5894
        | TEXT_STRING_sys { $$=$1;}
5861
5895
        | LEX_HOSTNAME { $$=$1;}
5865
5899
keyword:
5866
5900
          keyword_sp            {}
5867
5901
        | BEGIN_SYM             {}
5868
 
        | BYTE_SYM              {}
5869
5902
        | CHECKSUM_SYM          {}
5870
5903
        | CLOSE_SYM             {}
5871
5904
        | COMMENT_SYM           {}
6122
6155
        ;
6123
6156
 
6124
6157
option_value:
6125
 
          '@' ident_or_text_or_hostname equal expr
 
6158
          '@' ident_or_text_or_keyword_or_hostname equal expr
6126
6159
          {
6127
6160
            Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4)));
6128
6161
          }