~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

Merge trunk:

Show diffs side-by-side

added added

removed removed

Lines of Context:
911
911
 
912
912
%type <num>
913
913
        type int_type real_type order_dir field_def
914
 
        if_exists opt_table_options table_options
915
 
        table_option opt_if_not_exists
 
914
        if_exists opt_table_options
 
915
        opt_if_not_exists
916
916
        opt_temporary all_or_any opt_distinct
917
917
        union_option
918
918
        start_transaction_opts opt_chain opt_release
1142
1142
              DRIZZLE_YYABORT;
1143
1143
            lex->col_list.empty();
1144
1144
            statement->change=NULL;
1145
 
            statement->create_info.options=$2 | $4;
 
1145
            statement->is_if_not_exists= $4;
1146
1146
            statement->create_info.db_type= NULL;
1147
1147
            statement->create_info.default_table_charset= NULL;
1148
1148
            lex->name.str= 0;
1150
1150
            message::Table *proto= &statement->create_table_proto;
1151
1151
            
1152
1152
            proto->set_name($5->table.str);
1153
 
            if($2 & HA_LEX_CREATE_TMP_TABLE)
 
1153
            if($2)
1154
1154
              proto->set_type(message::Table::TEMPORARY);
1155
1155
            else
1156
1156
              proto->set_type(message::Table::STANDARD);
1196
1196
            lex->statement= statement;
1197
1197
            if (lex->statement == NULL)
1198
1198
              DRIZZLE_YYABORT;
1199
 
            statement->create_info.options=$3;
 
1199
            statement->is_if_not_exists= $3;
1200
1200
          }
1201
1201
          opt_create_database_options
1202
1202
          {
1214
1214
            LEX *lex= session->lex;
1215
1215
            statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1216
1216
 
1217
 
            statement->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
 
1217
            statement->is_create_table_like= true;
1218
1218
            if (!lex->select_lex.add_table_to_list(session, $2, NULL, 0, TL_READ))
1219
1219
              DRIZZLE_YYABORT;
1220
1220
          }
1224
1224
            LEX *lex= session->lex;
1225
1225
            statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1226
1226
 
1227
 
            statement->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
 
1227
            statement->is_create_table_like= true;
1228
1228
            if (!lex->select_lex.add_table_to_list(session, $3, NULL, 0, TL_READ))
1229
1229
              DRIZZLE_YYABORT;
1230
1230
          }
1304
1304
        ;
1305
1305
 
1306
1306
opt_table_options:
1307
 
          /* empty */ { $$= 0; }
1308
 
        | table_options  { $$= $1;}
1309
 
        ;
1310
 
 
1311
 
table_options:
1312
 
          table_option { $$=$1; }
1313
 
        | table_option table_options { $$= $1 | $2; }
1314
 
        ;
1315
 
 
1316
 
table_option:
1317
 
          TEMPORARY_SYM { $$=HA_LEX_CREATE_TMP_TABLE; }
 
1307
          /* empty */ { $$= false; }
 
1308
        | TEMPORARY_SYM { $$= true; }
1318
1309
        ;
1319
1310
 
1320
1311
opt_if_not_exists:
1321
 
          /* empty */ { $$= 0; }
1322
 
        | IF not EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }
 
1312
          /* empty */ { $$= false; }
 
1313
        | IF not EXISTS { $$= true; }
1323
1314
        ;
1324
1315
 
1325
1316
opt_create_table_options:
1342
1333
          ENGINE_SYM opt_equal ident_or_text
1343
1334
          {
1344
1335
            statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1345
 
 
1346
 
            statement->create_info.db_type= NULL;
1347
 
            statement->create_info.used_fields|= HA_CREATE_USED_ENGINE;
1348
 
 
1349
 
            {
1350
 
              message::Table::StorageEngine *protoengine;
1351
 
              protoengine= ((statement::CreateTable *)Lex->statement)->create_table_proto.mutable_engine();
1352
 
 
1353
 
              protoengine->set_name($3.str);
1354
 
            }
 
1336
            message::Table::StorageEngine *protoengine;
 
1337
            protoengine= ((statement::CreateTable *)Lex->statement)->create_table_proto.mutable_engine();
 
1338
 
 
1339
            statement->is_engine_set= true;
 
1340
 
 
1341
            protoengine->set_name($3.str);
1355
1342
          }
1356
1343
        | BLOCK_SIZE_SYM opt_equal ulong_num    
1357
1344
          { 
1371
1358
          }
1372
1359
        | AUTO_INC opt_equal ulonglong_num
1373
1360
          {
 
1361
            message::Table::TableOptions *tableopts;
1374
1362
            statement::CreateTable *statement= (statement::CreateTable *)Lex->statement;
1375
1363
 
 
1364
            tableopts= ((statement::CreateTable *)Lex->statement)->create_table_proto.mutable_options();
 
1365
 
1376
1366
            statement->create_info.auto_increment_value=$3;
1377
1367
            statement->create_info.used_fields|= HA_CREATE_USED_AUTO;
 
1368
            tableopts->set_auto_increment_value($3);
1378
1369
          }
1379
1370
        | ROW_FORMAT_SYM opt_equal row_types
1380
1371
          {
2277
2268
            lex->select_lex.init_order();
2278
2269
            lex->select_lex.db=
2279
2270
              ((TableList*) lex->select_lex.table_list.first)->db;
2280
 
            statement->create_info.db_type= 0;
2281
 
            statement->create_info.default_table_charset= NULL;
2282
2271
            statement->create_info.row_type= ROW_TYPE_NOT_USED;
2283
2272
            statement->alter_info.build_method= $2;
2284
2273
          }
5053
5042
            Lex->statement= statement;
5054
5043
            if (Lex->statement == NULL)
5055
5044
              DRIZZLE_YYABORT;
5056
 
            statement->create_info.options=$3;
 
5045
            statement->is_if_not_exists= $3;
5057
5046
            Lex->name= $4;
5058
5047
          }
5059
5048
        | CREATE TABLE_SYM table_ident