~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/parser.cc

  • Committer: Mark Atwood
  • Date: 2011-10-27 05:08:12 UTC
  • mfrom: (2445.1.11 rf)
  • Revision ID: me@mark.atwood.name-20111027050812-1icvs72lb0u4xdc4
mergeĀ lp:~olafvdspek/drizzle/refactor8

Show diffs side-by-side

added added

removed removed

Lines of Context:
326
326
  opt->set_state(boost::lexical_cast<std::string>(value));
327
327
}
328
328
 
329
 
bool checkFieldIdent(LEX *lex, const lex_string_t &schema_name, const lex_string_t &table_name)
 
329
bool checkFieldIdent(LEX *lex, str_ref schema_name, str_ref table_name)
330
330
{
331
331
  TableList *table= reinterpret_cast<TableList*>(lex->current_select->table_list.first);
332
332
 
333
 
  if (schema_name.size())
 
333
  if (schema_name.size() && my_strcasecmp(table_alias_charset, schema_name.data(), table->getSchemaName()))
334
334
  {
335
 
    if (my_strcasecmp(table_alias_charset, schema_name.data(), table->getSchemaName()))
336
 
    {
337
 
      my_error(ER_WRONG_DB_NAME, MYF(0), schema_name.data());
338
 
      return false;
339
 
    }
 
335
    my_error(ER_WRONG_DB_NAME, MYF(0), schema_name.data());
 
336
    return false;
340
337
  }
341
338
 
342
 
  if (my_strcasecmp(table_alias_charset, table_name.data(),
343
 
                    table->getTableName()))
 
339
  if (my_strcasecmp(table_alias_charset, table_name.data(), table->getTableName()))
344
340
  {
345
341
    my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name.data());
346
342
    return false;
349
345
  return true;
350
346
}
351
347
 
352
 
Item *buildIdent(LEX *lex, const lex_string_t &schema_name, const lex_string_t &table_name, const lex_string_t &field_name)
 
348
Item *buildIdent(LEX *lex, str_ref schema_name, str_ref table_name, str_ref field_name)
353
349
{
354
350
  Select_Lex *sel= lex->current_select;
355
351
 
363
359
    : (Item*) new Item_ref(lex->current_context(), schema_name.data(), table_name.data(), field_name.data());
364
360
}
365
361
 
366
 
Item *buildTableWild(LEX *lex, const lex_string_t &schema_name, const lex_string_t &table_name)
 
362
Item *buildTableWild(LEX *lex, str_ref schema_name, str_ref table_name)
367
363
{
368
364
  Select_Lex *sel= lex->current_select;
369
365
  Item *item= new Item_field(lex->current_context(), schema_name.data(), table_name.data(), "*");
412
408
  return true;
413
409
}
414
410
 
415
 
void buildKey(LEX *lex, Key::Keytype type_par, const lex_string_t &name_arg)
 
411
void buildKey(LEX *lex, Key::Keytype type_par, str_ref name_arg)
416
412
{
417
413
  statement::AlterTable *statement= (statement::AlterTable *)lex->statement;
418
414
  Key *key= new Key(type_par, name_arg, &statement->key_create_info, 0, lex->col_list);
420
416
  lex->col_list.clear(); /* Alloced by memory::sql_alloc */
421
417
}
422
418
 
423
 
void buildForeignKey(LEX *lex, const lex_string_t &name_arg, drizzled::Table_ident *table)
 
419
void buildForeignKey(LEX *lex, str_ref name_arg, drizzled::Table_ident *table)
424
420
{
425
421
  statement::AlterTable *statement= (statement::AlterTable *)lex->statement;
426
422
  statement->alter_info.key_list.push_back(new Foreign_key(name_arg, lex->col_list, table, lex->ref_list,