~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Brian Aker
  • Date: 2009-08-24 19:19:39 UTC
  • mfrom: (1121.1.6 merge)
  • Revision ID: brian@gaz-20090824191939-xcn528r7gwjc48h3
Merge Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
using namespace std;
44
44
 
45
45
/* Prototypes */
46
 
static bool append_file_to_dir(Session *session, const char **filename_ptr,
47
 
                               const char *table_name);
48
 
 
49
46
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
50
47
 
51
48
/**
528
525
    /* Might have been updated in create_table_precheck */
529
526
    create_info.alias= create_table->alias;
530
527
 
531
 
#ifdef HAVE_READLINK
532
 
    /* Fix names if symlinked tables */
533
 
    if (append_file_to_dir(session, &create_info.data_file_name,
534
 
                           create_table->table_name) ||
535
 
        append_file_to_dir(session, &create_info.index_file_name,
536
 
                           create_table->table_name))
537
 
      goto end_with_restore_list;
538
 
#endif
539
528
    /*
540
529
      The create-select command will open and read-lock the select table
541
530
      and then create, open and write-lock the new table. If a global
696
685
          tmp_table.db=select_lex->db;
697
686
      }
698
687
 
699
 
      /* Don't yet allow changing of symlinks with ALTER TABLE */
700
 
      if (create_info.data_file_name)
701
 
        push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
702
 
                     "DATA DIRECTORY option ignored");
703
 
      if (create_info.index_file_name)
704
 
        push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
705
 
                     "INDEX DIRECTORY option ignored");
706
 
      create_info.data_file_name= create_info.index_file_name= NULL;
707
688
      /* ALTER TABLE ends previous transaction */
708
689
      if (! session->endActiveTransaction())
709
690
        goto error;
1987
1968
}
1988
1969
 
1989
1970
 
1990
 
/** If pointer is not a null pointer, append filename to it. */
1991
 
 
1992
 
static bool append_file_to_dir(Session *session, const char **filename_ptr,
1993
 
                               const char *table_name)
1994
 
{
1995
 
  char buff[FN_REFLEN],*ptr, *end;
1996
 
  if (!*filename_ptr)
1997
 
    return 0;                                   // nothing to do
1998
 
 
1999
 
  /* Check that the filename is not too long and it's a hard path */
2000
 
  if (strlen(*filename_ptr)+strlen(table_name) >= FN_REFLEN-1 ||
2001
 
      !test_if_hard_path(*filename_ptr))
2002
 
  {
2003
 
    my_error(ER_WRONG_TABLE_NAME, MYF(0), *filename_ptr);
2004
 
    return 1;
2005
 
  }
2006
 
  /* Fix is using unix filename format on dos */
2007
 
  strcpy(buff,*filename_ptr);
2008
 
  end=convert_dirname(buff, *filename_ptr, NULL);
2009
 
  if (!(ptr= (char*) session->alloc((size_t) (end-buff) + strlen(table_name)+1)))
2010
 
    return 1;                                   // End of memory
2011
 
  *filename_ptr=ptr;
2012
 
  sprintf(ptr,"%s%s",buff,table_name);
2013
 
  return 0;
2014
 
}
2015
 
 
2016
 
 
2017
1971
/**
2018
1972
  Check if the select is a simple select (not an union).
2019
1973