~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/parser.cc

  • Committer: Brian Aker
  • Date: 2011-02-08 01:20:28 UTC
  • mto: (2152.2.1 alter-table)
  • mto: This revision was merged to the branch mainline in revision 2154.
  • Revision ID: brian@tangent.org-20110208012028-520iafbsfawm145j
Move integer building into parser code file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
453
453
  statement->alter_info.flags.set(ALTER_FOREIGN_KEY);
454
454
}
455
455
 
 
456
drizzled::enum_field_types buildIntegerColumn(LEX *lex, drizzled::enum_field_types final_type, const bool is_unsigned)
 
457
 
458
  lex->length=(char*) 0; /* use default length */
 
459
 
 
460
  if (is_unsigned)
 
461
  {
 
462
    final_type= DRIZZLE_TYPE_LONGLONG;
 
463
  }
 
464
 
 
465
  if (lex->field())
 
466
  {
 
467
    assert (final_type == DRIZZLE_TYPE_LONG or final_type == DRIZZLE_TYPE_LONGLONG);
 
468
    // We update the type for unsigned types
 
469
    if (is_unsigned)
 
470
    {
 
471
      lex->field()->set_type(message::Table::Field::BIGINT);
 
472
      lex->field()->mutable_constraints()->set_is_unsigned(true);
 
473
    }
 
474
    else if (final_type == DRIZZLE_TYPE_LONG)
 
475
    {
 
476
      lex->field()->set_type(message::Table::Field::INTEGER);
 
477
    }
 
478
    else if (final_type == DRIZZLE_TYPE_LONGLONG)
 
479
    {
 
480
      lex->field()->set_type(message::Table::Field::BIGINT);
 
481
    }
 
482
  }
 
483
 
 
484
  return final_type;
 
485
}
 
486
 
456
487
} // namespace parser
457
488
} // namespace drizzled