~ubuntu-branches/ubuntu/natty/mysql-5.1/natty-proposed

« back to all changes in this revision

Viewing changes to sql/sql_partition.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 08:30:45 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120222083045-2rd53r4bnyx7qus4
Tags: 5.1.61-0ubuntu0.11.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc.
 
1
/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
761
761
  bool result;
762
762
  char *field_name;
763
763
  bool is_list_empty= TRUE;
 
764
  int fields_handled = 0;
 
765
  char* field_name_array[MAX_KEY];
 
766
 
764
767
  DBUG_ENTER("handle_list_of_fields");
765
768
 
766
769
  while ((field_name= it++))
776
779
      result= TRUE;
777
780
      goto end;
778
781
    }
 
782
 
 
783
    /*
 
784
      Check for duplicate fields in the list.
 
785
      Assuming that there are not many fields in the partition key list.
 
786
      If there were, it would be better to replace the for-loop
 
787
      with a more efficient algorithm.
 
788
    */
 
789
 
 
790
    field_name_array[fields_handled] = field_name;
 
791
    for (int i = 0; i < fields_handled; ++i)
 
792
    {
 
793
      if (my_strcasecmp(system_charset_info,
 
794
                        field_name_array[i], field_name) == 0)
 
795
      {
 
796
        my_error(ER_FIELD_NOT_FOUND_PART_ERROR, MYF(0));
 
797
        DBUG_RETURN(TRUE);
 
798
      }
 
799
    }
 
800
    fields_handled++;
779
801
  }
780
802
  if (is_list_empty)
781
803
  {
908
930
  const char *save_where;
909
931
  char* db_name;
910
932
  char db_name_string[FN_REFLEN];
911
 
  bool save_use_only_table_context;
912
 
  uint8 saved_full_group_by_flag;
913
 
  nesting_map saved_allow_sum_func;
914
933
  DBUG_ENTER("fix_fields_part_func");
915
934
 
916
935
  if (part_info->fixed)
977
996
    of interesting side effects, both desirable and undesirable.
978
997
  */
979
998
 
980
 
  save_use_only_table_context= thd->lex->use_only_table_context;
981
 
  thd->lex->use_only_table_context= TRUE;
982
 
  thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
983
 
  saved_full_group_by_flag= thd->lex->current_select->full_group_by_flag;
984
 
  saved_allow_sum_func= thd->lex->allow_sum_func;
985
 
  thd->lex->allow_sum_func= 0;
 
999
  {
 
1000
    const bool save_use_only_table_context= thd->lex->use_only_table_context;
 
1001
    thd->lex->use_only_table_context= TRUE;
 
1002
    thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
 
1003
    const bool save_agg_field= thd->lex->current_select->non_agg_field_used();
 
1004
    const bool save_agg_func=  thd->lex->current_select->agg_func_used();
 
1005
    const nesting_map saved_allow_sum_func= thd->lex->allow_sum_func;
 
1006
    thd->lex->allow_sum_func= 0;
986
1007
  
987
 
  error= func_expr->fix_fields(thd, (Item**)&func_expr);
988
 
 
989
 
  /*
990
 
    Restore full_group_by_flag and allow_sum_func,
991
 
    fix_fields should not affect mysql_select later, see Bug#46923.
992
 
  */
993
 
  thd->lex->current_select->full_group_by_flag= saved_full_group_by_flag;
994
 
  thd->lex->allow_sum_func= saved_allow_sum_func;
995
 
 
996
 
  thd->lex->use_only_table_context= save_use_only_table_context;
 
1008
    error= func_expr->fix_fields(thd, (Item**)&func_expr);
 
1009
 
 
1010
    /*
 
1011
      Restore agg_field/agg_func and allow_sum_func,
 
1012
      fix_fields should not affect mysql_select later, see Bug#46923.
 
1013
    */
 
1014
    thd->lex->current_select->set_non_agg_field_used(save_agg_field);
 
1015
    thd->lex->current_select->set_agg_func_used(save_agg_func);
 
1016
    thd->lex->allow_sum_func= saved_allow_sum_func;
 
1017
    thd->lex->use_only_table_context= save_use_only_table_context;
 
1018
  }
997
1019
 
998
1020
  context->table_list= save_table_list;
999
1021
  context->first_name_resolution_table= save_first_table;
1014
1036
  }
1015
1037
 
1016
1038
  /*
1017
 
    We don't allow creating partitions with timezone-dependent expressions as
1018
 
    a (sub)partitioning function, but we want to allow such expressions when
1019
 
    opening existing tables for easier maintenance. This exception should be
1020
 
    deprecated at some point in future so that we always throw an error.
 
1039
    We don't allow creating partitions with expressions with non matching
 
1040
    arguments as a (sub)partitioning function,
 
1041
    but we want to allow such expressions when opening existing tables for
 
1042
    easier maintenance. This exception should be deprecated at some point
 
1043
    in future so that we always throw an error.
1021
1044
  */
1022
 
  if (func_expr->walk(&Item::is_timezone_dependent_processor,
 
1045
  if (func_expr->walk(&Item::check_valid_arguments_processor,
1023
1046
                      0, NULL))
1024
1047
  {
1025
1048
    if (is_create_table_ind)
6548
6571
 
6549
6572
void mem_alloc_error(size_t size)
6550
6573
{
6551
 
  my_error(ER_OUTOFMEMORY, MYF(0), size);
 
6574
  my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(size));
6552
6575
}
6553
6576
 
6554
6577
#ifdef WITH_PARTITION_STORAGE_ENGINE