~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

« back to all changes in this revision

Viewing changes to sql/table.cc

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-04-25 08:06:10 UTC
  • mfrom: (1.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20140425080610-4k2xstl3pagqvsmb
Tags: 5.6.17-1~exp1
* SECURITY UPDATE: New upstream release (Closes: #744970).
  - http://www.oracle.com/technetwork/topics/security/cpuapr2014-1972952.html
  - CVE-2014-0001
  - CVE-2014-2430
  - CVE-2014-2431
  - CVE-2014-2435
  - CVE-2014-2436
  - CVE-2014-2440
* d/p/CVE-2014-0001.patch: Dropped, included in security update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
   Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
 
2
   Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3
3
 
4
4
   This program is free software; you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
5625
5625
{
5626
5626
  DBUG_ASSERT(!created && s->keys && key_to_save < (int)s->keys);
5627
5627
 
5628
 
  /* Correct fields' info about taking part in keys */
5629
 
  for (int i= 0; i < (int)s->keys; i++)
 
5628
  Field **reg_field;
 
5629
  /*
 
5630
    Reset the flags and maps associated with the fields. They are set
 
5631
    only for the key chosen by the optimizer later.
 
5632
   */
 
5633
  for (reg_field=field ; *reg_field; reg_field++)
5630
5634
  {
5631
 
    uint j;
5632
 
    KEY_PART_INFO *kp;
5633
 
    for (kp= key_info[i].key_part, j= 0;
5634
 
         j < key_info[i].user_defined_key_parts;
5635
 
         j++, kp++)
5636
 
    {
5637
 
      if (i == key_to_save)
5638
 
      {
5639
 
        if (kp->field->key_start.is_set(i))
5640
 
          kp->field->key_start.set_prefix(1);
5641
 
        kp->field->part_of_key.set_prefix(1);
5642
 
        kp->field->part_of_sortkey.set_prefix(1);
5643
 
      }
5644
 
      else
5645
 
      {
5646
 
        kp->field->key_start.clear_all();
5647
 
        kp->field->part_of_key.clear_all();
5648
 
        kp->field->part_of_sortkey.clear_all();
5649
 
      }
5650
 
    }
 
5635
    if(!(*reg_field)->part_of_key.is_set(key_to_save))
 
5636
      (*reg_field)->key_start.clear_all();
 
5637
    (*reg_field)->part_of_key.clear_all();
 
5638
    (*reg_field)->part_of_sortkey.clear_all();
 
5639
    (*reg_field)->flags&= ~PART_KEY_FLAG;
5651
5640
  }
5652
5641
 
 
5642
  /* Drop all keys if none of them were chosen */
5653
5643
  if (key_to_save < 0)
5654
5644
  {
5655
 
    /* Drop all keys; */
5656
5645
    key_info= s->key_info= 0;
5657
5646
    s->key_parts= 0;
5658
5647
    s->keys= 0;
5662
5651
  }
5663
5652
  else
5664
5653
  {
 
5654
    /* Set the flags and maps for the key chosen by the optimizer */
 
5655
    uint i;
 
5656
    KEY_PART_INFO *kp;
 
5657
    for (kp= key_info[key_to_save].key_part, i= 0;
 
5658
         i < key_info[key_to_save].user_defined_key_parts;
 
5659
         i++, kp++)
 
5660
    {
 
5661
      if (kp->field->key_start.is_set(key_to_save))
 
5662
        kp->field->key_start.set_prefix(1);
 
5663
      kp->field->part_of_key.set_prefix(1);
 
5664
      kp->field->part_of_sortkey.set_prefix(1);
 
5665
      kp->field->flags|= PART_KEY_FLAG;
 
5666
    }
 
5667
 
5665
5668
    /* Save the given key. No need to copy key#0. */
5666
5669
    if (key_to_save > 0)
5667
5670
      key_info[0]= key_info[key_to_save];