~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to sql/table.cc

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.2.1 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100621153105-lv81twvjdgzvzrre
Tags: 5.1.48-1ubuntu1
* Merge from debian unstable, remaining changes:
  + debian/control:
     * Update maintainer according to spec.
     * Move section from "misc" to "database".
     * Added libmysqlclient16-dev an empty transitional package. 
     * Added mysql-client-core-5.1 package.
     * Suggest mailx for mysql-server-5.1
     * Add mysql-testsuite package so you can run the testsuite seperately.
  + debian/additions/my.cnf:
    * Remove language options. Error message files are located in a different directory in Mysql
      5.0. Setting the language option to use /usr/share/mysql/english breaks Mysql 5.0. Both 5.0
      and 5.1 use a different value that works. (LP: #316974)
  + Add apparmor profile:
    + debian/apparmor-profile: apparmor-profile
    + debian/rules, debian/mysql-server-5.1.files: install apparmor profile
    + debian/mysql-server-5.1.dirs: add etc/apparmor.d/fore-complain
    + debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on purge.
    + debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    + debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    + debian/mysql-server-5.1.postinst: reload apparmor profiles
  * Convert the package from sysvinit to upstart:
    + debian/mysql-server-5.1.mysql.upstart: Add upstart script.
    + debian/mysql-server-5.1.mysql.init: Dropped, unused now with upstart.
    + debian/additions/mysqld_safe_syslog.cnf: Dropped, unused now with upstart.
    + debian/additons/my.cnf: Remove pid declaration and setup error logging to /var/log/mysql since
      we're not piping anything around logger anymore.
    + debian/rules, debian/mysql-server-5.1.logcheck.ignore.{paranoid,worstation},
      debian/mysql-server-5.1.logcheck.ignore.server: : Remove references to mysqld_safe
    + debian/patches/38_scripts_mysqld_safe.sh_signals.dpatch: Dropped
  * Added -fno-strict-aliasing to CFLAGS to get around mysql testsuite build failures.
  * Add Apport hook (LP: #354188):
    + debian/mysql-server-5.1.py: apport package hook
    + debian/rules: Make it installable
  * debian/mysql-server-5.1.mysql-server.logrotate: Check to see if mysql is running before
    running logrotate. (LP: #513135)
  * Make the testsuite installable. (LP: #530752)
    + debian/mysql-server-5.1.files, debian/rules: install apport package hook
  * debian/mysql-server-5.1.preinst: Set mysql user's home directory
    to /nonexistent to protect against having the /var/lib/mysql
    user-writeable. If an attacker can trick mysqld into creating
    dot files in the home directory, he could do .rhost-like attacks
    on the system. (LP: #293258)
  * debian/control: mysql-client-5.1 should depend on mysql-core-client-5.1.
    (LP: #590952) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
297
297
    share->version=       refresh_version;
298
298
 
299
299
    /*
300
 
      This constant is used to mark that no table map version has been
301
 
      assigned.  No arithmetic is done on the value: it will be
302
 
      overwritten with a value taken from MYSQL_BIN_LOG.
303
 
    */
304
 
    share->table_map_version= ~(ulonglong)0;
305
 
 
306
 
    /*
307
300
      Since alloc_table_share() can be called without any locking (for
308
301
      example, ha_create_table... functions), we do not assign a table
309
302
      map id here.  Instead we assign a value that is not used
366
359
  share->path.length= share->normalized_path.length= strlen(path);
367
360
  share->frm_version=            FRM_VER_TRUE_VARCHAR;
368
361
 
369
 
  /*
370
 
    Temporary tables are not replicated, but we set up these fields
371
 
    anyway to be able to catch errors.
372
 
   */
373
 
  share->table_map_version= ~(ulonglong)0;
374
362
  share->cached_row_logging_check= -1;
375
363
 
376
364
  /*
2701
2689
{
2702
2690
  char *name= org_name->str;
2703
2691
  uint name_length= org_name->length;
 
2692
  bool check_for_path_chars;
2704
2693
 
2705
2694
  if (!name_length || name_length > NAME_LEN)
2706
2695
    return 1;
2707
2696
 
 
2697
  if ((check_for_path_chars= check_mysql50_prefix(name)))
 
2698
  {
 
2699
    name+= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
 
2700
    name_length-= MYSQL50_TABLE_NAME_PREFIX_LENGTH;
 
2701
  }
 
2702
 
2708
2703
  if (lower_case_table_names && name != any_db)
2709
2704
    my_casedn_str(files_charset_info, name);
2710
2705
 
2711
 
#if defined(USE_MB) && defined(USE_MB_IDENT)
2712
 
  if (use_mb(system_charset_info))
2713
 
  {
2714
 
    name_length= 0;
2715
 
    bool last_char_is_space= TRUE;
2716
 
    char *end= name + org_name->length;
2717
 
    while (name < end)
2718
 
    {
2719
 
      int len;
2720
 
      last_char_is_space= my_isspace(system_charset_info, *name);
2721
 
      len= my_ismbchar(system_charset_info, name, end);
2722
 
      if (!len)
2723
 
        len= 1;
2724
 
      name+= len;
2725
 
      name_length++;
2726
 
    }
2727
 
    return (last_char_is_space || name_length > NAME_CHAR_LEN);
2728
 
  }
2729
 
  else
2730
 
#endif
2731
 
    return ((org_name->str[org_name->length - 1] != ' ') ||
2732
 
            (name_length > NAME_CHAR_LEN)); /* purecov: inspected */
 
2706
  return check_table_name(name, name_length, check_for_path_chars);
2733
2707
}
2734
2708
 
 
2709
 
2735
2710
/*
2736
2711
  Allow anything as a table name, as long as it doesn't contain an
2737
2712
  ' ' at the end
2738
2713
  returns 1 on error
2739
2714
*/
2740
2715
 
2741
 
 
2742
2716
bool check_table_name(const char *name, uint length, bool check_for_path_chars)
2743
2717
{
2744
2718
  uint name_length= 0;  // name length in symbols
2766
2740
        continue;
2767
2741
      }
2768
2742
    }
 
2743
#endif
2769
2744
    if (check_for_path_chars &&
2770
2745
        (*name == '/' || *name == '\\' || *name == '~' || *name == FN_EXTCHAR))
2771
2746
      return 1;
2772
 
#endif
2773
2747
    name++;
2774
2748
    name_length++;
2775
2749
  }
4404
4378
 
4405
4379
 
4406
4380
/*
 
4381
  Add fields used by a specified index to the table's read_set.
 
4382
 
 
4383
  NOTE:
 
4384
    The original state can be restored with
 
4385
    restore_column_maps_after_mark_index().
 
4386
*/
 
4387
 
 
4388
void st_table::add_read_columns_used_by_index(uint index)
 
4389
{
 
4390
  MY_BITMAP *bitmap= &tmp_set;
 
4391
  DBUG_ENTER("st_table::add_read_columns_used_by_index");
 
4392
 
 
4393
  set_keyread(TRUE);
 
4394
  bitmap_copy(bitmap, read_set);
 
4395
  mark_columns_used_by_index_no_reset(index, bitmap);
 
4396
  column_bitmaps_set(bitmap, write_set);
 
4397
  DBUG_VOID_RETURN;
 
4398
}
 
4399
 
 
4400
 
 
4401
/*
4407
4402
  Restore to use normal column maps after key read
4408
4403
 
4409
4404
  NOTES