~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/parser.cc

  • Committer: Brian Aker
  • Date: 2011-02-07 21:28:53 UTC
  • mto: (2152.2.1 alter-table)
  • mto: This revision was merged to the branch mainline in revision 2154.
  • Revision ID: brian@tangent.org-20110207212853-wz23gflb12rk90pv
Move over the collation test to a function outside of the parser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
405
405
  statement->alter_info.flags.set(ALTER_COLUMN_ORDER);
406
406
}
407
407
 
 
408
bool buildCollation(LEX *lex, const CHARSET_INFO *arg)
 
409
{
 
410
  statement::CreateTable *statement= (statement::CreateTable *)lex->statement;
 
411
 
 
412
  HA_CREATE_INFO *cinfo= &statement->create_info();
 
413
  if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
 
414
      cinfo->default_table_charset && arg &&
 
415
      !my_charset_same(cinfo->default_table_charset, arg))
 
416
  {
 
417
    my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
 
418
             arg->name, cinfo->default_table_charset->csname);
 
419
    return false;
 
420
  }
 
421
  statement->create_info().default_table_charset= arg;
 
422
  statement->create_info().used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
 
423
 
 
424
  return true;
 
425
}
 
426
 
408
427
} // namespace parser
409
428
} // namespace drizzled