~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Mark Atwood
  • Date: 2011-08-03 15:44:55 UTC
  • mfrom: (2318.8.15 refactor2)
  • Revision ID: me@mark.atwood.name-20110803154455-jqg3gnxofkq8wetv
mergeĀ lp:~olafvdspek/drizzle/refactor2

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
#include <drizzled/system_variables.h>
60
60
#include <drizzled/session/times.h>
61
61
#include <drizzled/session/transactions.h>
 
62
#include <drizzled/create_field.h>
 
63
#include <drizzled/lex_input_stream.h>
62
64
 
63
65
#include <limits.h>
64
66
 
805
807
*/
806
808
 
807
809
bool add_field_to_list(Session *session, lex_string_t *field_name, enum_field_types type,
808
 
                       char *length, char *decimals,
 
810
                       const char *length, const char *decimals,
809
811
                       uint32_t type_modifier,
810
812
                       enum column_format_type column_format,
811
813
                       Item *default_value, Item *on_update_value,
812
814
                       lex_string_t *comment,
813
 
                       char *change,
 
815
                       const char *change,
814
816
                       List<String> *interval_list, const charset_info_st * const cs)
815
817
{
816
818
  register CreateField *new_field;
920
922
                                         lex_string_t *option)
921
923
{
922
924
  TableList *previous_table_ref; /* The table preceding the current one. */
923
 
  char *alias_str;
924
925
  LEX *lex= &session->lex();
925
926
 
926
927
  if (!table)
927
928
    return NULL;                                // End of memory
928
 
  alias_str= alias ? alias->str : table->table.str;
 
929
  const char* alias_str= alias ? alias->str : table->table.str;
929
930
  if (! table_options.test(TL_OPTION_ALIAS) &&
930
931
      check_table_name(table->table.str, table->table.length))
931
932
  {
961
962
  if (table->db.str)
962
963
  {
963
964
    ptr->setIsFqtn(true);
964
 
    ptr->setSchemaName(table->db.str);
965
 
    ptr->db_length= table->db.length;
 
965
    ptr->setSchemaName(table->db.str, table->db.length);
966
966
  }
967
 
  else if (lex->copy_db_to(ptr->getSchemaNamePtr(), &ptr->db_length))
 
967
  else if (lex->session->copy_db_to(*ptr->getSchemaNamePtr(), ptr->db_length))
968
968
    return NULL;
969
969
  else
970
970
    ptr->setIsFqtn(false);
971
971
 
972
972
  ptr->alias= alias_str;
973
973
  ptr->setIsAlias(alias ? true : false);
974
 
  ptr->setTableName(table->table.str);
975
 
  ptr->table_name_length=table->table.length;
 
974
  ptr->setTableName(table->table.str, table->table.length);
976
975
  ptr->lock_type=   lock_type;
977
976
  ptr->force_index= table_options.test(TL_OPTION_FORCE_INDEX);
978
977
  ptr->ignore_leaves= table_options.test(TL_OPTION_IGNORE_LEAVES);
984
983
  if (lock_type != TL_IGNORE)
985
984
  {
986
985
    TableList *first_table= (TableList*) table_list.first;
987
 
    for (TableList *tables= first_table ;
988
 
         tables ;
989
 
         tables=tables->next_local)
 
986
    for (TableList *tables= first_table; tables; tables= tables->next_local)
990
987
    {
991
988
      if (not my_strcasecmp(table_alias_charset, alias_str, tables->alias) &&
992
 
          not my_strcasecmp(system_charset_info, ptr->getSchemaName(), tables->getSchemaName()))
 
989
        not my_strcasecmp(system_charset_info, ptr->getSchemaName(), tables->getSchemaName()))
993
990
      {
994
 
        my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str);
995
 
        return NULL;
 
991
        my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str);
 
992
        return NULL;
996
993
      }
997
994
    }
998
995
  }