~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Mark Atwood
  • Date: 2011-10-14 15:59:08 UTC
  • mfrom: (2430.1.12 refactor3a)
  • Revision ID: me@mark.atwood.name-20111014155908-whqmrmaf2grpsg5c
mergeĀ lp:~olafvdspek/drizzle/refactor3

Show diffs side-by-side

added added

removed removed

Lines of Context:
727
727
  init_select(&lex);
728
728
  lex.sql_command= SQLCOM_SELECT;
729
729
  lex_string_t tmp;
730
 
  tmp.str= (char*) var_name;
731
 
  tmp.length=strlen(var_name);
 
730
  tmp.assign(var_name, strlen(var_name));
732
731
  /*
733
732
    We set the name of Item to @@session.var_name because that then is used
734
733
    as the column name in the output.
905
904
  if (!table)
906
905
    return NULL;                                // End of memory
907
906
  const char* alias_str= alias ? alias->data() : table->table.data();
908
 
  if (! table_options.test(TL_OPTION_ALIAS) &&
909
 
      check_table_name(table->table.str, table->table.length))
 
907
  if (not table_options.test(TL_OPTION_ALIAS) &&
 
908
      check_table_name(table->table.data(), table->table.size()))
910
909
  {
911
 
    my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
 
910
    my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.data());
912
911
    return NULL;
913
912
  }
914
913
 
915
 
  if (not table->is_derived_table() && table->db.str)
 
914
  if (not table->is_derived_table() && table->db.data())
916
915
  {
917
 
    my_casedn_str(files_charset_info, table->db.str);
918
 
    if (not schema::check(*session, identifier::Schema(table->db.str)))
 
916
    my_casedn_str(files_charset_info, table->db.str_);
 
917
    if (not schema::check(*session, identifier::Schema(table->db.data())))
919
918
    {
920
 
      my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
 
919
      my_error(ER_WRONG_DB_NAME, MYF(0), table->db.data());
921
920
      return NULL;
922
921
    }
923
922
  }
929
928
      my_message(ER_DERIVED_MUST_HAVE_ALIAS, ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
930
929
      return NULL;
931
930
    }
932
 
    alias_str= (char*) session->mem.memdup(alias_str, table->table.length+1);
 
931
    alias_str= (char*) session->mem.memdup(alias_str, table->table.size() + 1);
933
932
  }
934
933
  TableList *ptr = (TableList *) session->mem.calloc(sizeof(TableList));
935
934
 
936
 
  char* name;
937
 
  size_t name_size;
938
 
  if (table->db.str)
 
935
  if (table->db.data())
939
936
  {
940
937
    ptr->setIsFqtn(true);
941
 
    ptr->setSchemaName(table->db.str);
 
938
    ptr->setSchemaName(table->db.data());
942
939
  }
943
 
  else if (lex->session->copy_db_to(name, name_size))
944
 
    return NULL;
945
 
  else
 
940
  else 
946
941
  {
 
942
    str_ref schema = lex->session->copy_db_to();
 
943
    if (schema.empty())
 
944
      return NULL;
947
945
    ptr->setIsFqtn(false);
948
 
    ptr->setSchemaName(name);
 
946
    ptr->setSchemaName(schema.data());
949
947
  }
950
948
 
951
949
  ptr->alias= alias_str;
952
950
  ptr->setIsAlias(alias ? true : false);
953
 
  ptr->setTableName(table->table.str);
 
951
  ptr->setTableName(table->table.data());
954
952
  ptr->lock_type=   lock_type;
955
953
  ptr->force_index= table_options.test(TL_OPTION_FORCE_INDEX);
956
954
  ptr->ignore_leaves= table_options.test(TL_OPTION_IGNORE_LEAVES);
1561
1559
  int well_formed_error;
1562
1560
  uint32_t res= cs->cset->well_formed_len(cs, str->begin(), str->end(), max_char_length, &well_formed_error);
1563
1561
 
1564
 
  if (!well_formed_error &&  str->length == res)
 
1562
  if (!well_formed_error &&  str->size() == res)
1565
1563
    return false;
1566
1564
 
1567
1565
  if (!no_error)
1590
1588
    return true;
1591
1589
  }
1592
1590
 
1593
 
  if (str->length == res)
 
1591
  if (str->size() == res)
1594
1592
    return false;
1595
1593
 
1596
1594
  switch (err_code)