~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
941
941
    identifier::Schema schema_identifier(string(table->db.str));
942
942
    if (not schema::check(*session, schema_identifier))
943
943
    {
944
 
 
945
944
      my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
946
945
      return NULL;
947
946
    }
951
950
  {
952
951
    if (table->sel)
953
952
    {
954
 
      my_message(ER_DERIVED_MUST_HAVE_ALIAS,
955
 
                 ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
 
953
      my_message(ER_DERIVED_MUST_HAVE_ALIAS, ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
956
954
      return NULL;
957
955
    }
958
956
    alias_str= (char*) session->mem.memdup(alias_str,table->table.length+1);
959
957
  }
960
958
  TableList *ptr = (TableList *) session->mem.calloc(sizeof(TableList));
961
959
 
 
960
  char* name;
 
961
  size_t name_size;
962
962
  if (table->db.str)
963
963
  {
964
964
    ptr->setIsFqtn(true);
965
 
    ptr->setSchemaName(table->db.str, table->db.length);
 
965
    ptr->setSchemaName(table->db.str);
966
966
  }
967
 
  else if (lex->session->copy_db_to(*ptr->getSchemaNamePtr(), ptr->db_length))
 
967
  else if (lex->session->copy_db_to(name, name_size))
968
968
    return NULL;
969
969
  else
 
970
  {
970
971
    ptr->setIsFqtn(false);
 
972
    ptr->setSchemaName(name);
 
973
  }
971
974
 
972
975
  ptr->alias= alias_str;
973
976
  ptr->setIsAlias(alias ? true : false);
974
 
  ptr->setTableName(table->table.str, table->table.length);
 
977
  ptr->setTableName(table->table.str);
975
978
  ptr->lock_type=   lock_type;
976
979
  ptr->force_index= table_options.test(TL_OPTION_FORCE_INDEX);
977
980
  ptr->ignore_leaves= table_options.test(TL_OPTION_IGNORE_LEAVES);