~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to sql/sql_table.cc

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.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.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.0.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
uint filename_to_tablename(const char *from, char *to, uint to_length)
85
85
{
86
86
  uint errors;
87
 
  uint res;
 
87
  size_t res;
88
88
  DBUG_ENTER("filename_to_tablename");
89
89
  DBUG_PRINT("enter", ("from '%s'", from));
90
90
 
224
224
  char *end = buff + bufflen;
225
225
  /* Don't add FN_ROOTDIR if mysql_data_home already includes it */
226
226
  char *pos = strnmov(buff, mysql_data_home, bufflen);
227
 
  int rootdir_len= strlen(FN_ROOTDIR);
 
227
  size_t rootdir_len= strlen(FN_ROOTDIR);
228
228
  if (pos - rootdir_len >= buff &&
229
229
      memcmp(pos - rootdir_len, FN_ROOTDIR, rootdir_len) != 0)
230
230
    pos= strnmov(pos, FN_ROOTDIR, end - pos);
273
273
    my_casedn_str(files_charset_info, p);
274
274
  }
275
275
 
276
 
  uint length= unpack_filename(buff, buff);
 
276
  size_t length= unpack_filename(buff, buff);
277
277
  DBUG_PRINT("exit", ("buff: '%s'", buff));
278
278
  DBUG_RETURN(length);
279
279
}
1991
1991
  for (pos= interval->type_names, len= interval->type_lengths;
1992
1992
       *pos ; pos++, len++)
1993
1993
  {
1994
 
    uint length= cs->cset->numchars(cs, *pos, *pos + *len);
 
1994
    size_t length= cs->cset->numchars(cs, *pos, *pos + *len);
1995
1995
    *tot_length+= length;
1996
1996
    set_if_bigger(*max_length, (uint32)length);
1997
1997
  }
2320
2320
        DBUG_ASSERT(comma_length > 0);
2321
2321
        for (uint i= 0; (tmp= int_it++); i++)
2322
2322
        {
2323
 
          uint lengthsp;
 
2323
          size_t lengthsp;
2324
2324
          if (String::needs_conversion(tmp->length(), tmp->charset(),
2325
2325
                                       cs, &dummy))
2326
2326
          {
3321
3321
      if (key->type == Key::FOREIGN_KEY &&
3322
3322
          !part_info->is_auto_partitioned)
3323
3323
      {
3324
 
        my_error(ER_CANNOT_ADD_FOREIGN, MYF(0));
 
3324
        my_error(ER_FOREIGN_KEY_ON_PARTITIONED, MYF(0));
3325
3325
        goto err;
3326
3326
      }
3327
3327
    }
4236
4236
              (!(alter_info->flags & ALTER_ALL_PARTITION)))
4237
4237
          {
4238
4238
            char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
4239
 
            uint length;
 
4239
            size_t length;
4240
4240
            DBUG_PRINT("admin", ("sending non existent partition error"));
4241
4241
            protocol->prepare_for_resend();
4242
4242
            protocol->store(table_name, system_charset_info);
4297
4297
          view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
4298
4298
        push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
4299
4299
                     ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
4300
 
      result_code= HA_ADMIN_CORRUPT;
 
4300
      if (thd->main_da.is_error() && 
 
4301
          (thd->main_da.sql_errno() == ER_NO_SUCH_TABLE ||
 
4302
           thd->main_da.sql_errno() == ER_FILE_NOT_FOUND))
 
4303
        /* A missing table is just issued as a failed command */
 
4304
        result_code= HA_ADMIN_FAILED;
 
4305
      else
 
4306
        /* Default failure code is corrupt table */
 
4307
        result_code= HA_ADMIN_CORRUPT;
4301
4308
      goto send_result;
4302
4309
    }
4303
4310
 
4318
4325
    {
4319
4326
      /* purecov: begin inspected */
4320
4327
      char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
4321
 
      uint length;
 
4328
      size_t length;
4322
4329
      DBUG_PRINT("admin", ("sending error message"));
4323
4330
      protocol->prepare_for_resend();
4324
4331
      protocol->store(table_name, system_charset_info);
4435
4442
    switch (result_code) {
4436
4443
    case HA_ADMIN_NOT_IMPLEMENTED:
4437
4444
      {
4438
 
        char buf[ERRMSGSIZE+20];
4439
 
        uint length=my_snprintf(buf, ERRMSGSIZE,
 
4445
       char buf[MYSQL_ERRMSG_SIZE];
 
4446
       size_t length=my_snprintf(buf, sizeof(buf),
4440
4447
                                ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
4441
4448
        protocol->store(STRING_WITH_LEN("note"), system_charset_info);
4442
4449
        protocol->store(buf, length, system_charset_info);
4445
4452
 
4446
4453
    case HA_ADMIN_NOT_BASE_TABLE:
4447
4454
      {
4448
 
        char buf[ERRMSGSIZE+20];
4449
 
        uint length= my_snprintf(buf, ERRMSGSIZE,
 
4455
        char buf[MYSQL_ERRMSG_SIZE];
 
4456
        size_t length= my_snprintf(buf, sizeof(buf),
4450
4457
                                 ER(ER_BAD_TABLE_ERROR), table_name);
4451
4458
        protocol->store(STRING_WITH_LEN("note"), system_charset_info);
4452
4459
        protocol->store(buf, length, system_charset_info);
4573
4580
    case HA_ADMIN_NEEDS_UPGRADE:
4574
4581
    case HA_ADMIN_NEEDS_ALTER:
4575
4582
    {
4576
 
      char buf[ERRMSGSIZE];
4577
 
      uint length;
 
4583
      char buf[MYSQL_ERRMSG_SIZE];
 
4584
      size_t length;
4578
4585
 
4579
4586
      protocol->store(STRING_WITH_LEN("error"), system_charset_info);
4580
 
      length=my_snprintf(buf, ERRMSGSIZE, ER(ER_TABLE_NEEDS_UPGRADE), table->table_name);
 
4587
      length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
 
4588
                         table->table_name);
4581
4589
      protocol->store(buf, length, system_charset_info);
4582
4590
      fatal_error=1;
4583
4591
      break;
4585
4593
 
4586
4594
    default:                            // Probably HA_ADMIN_INTERNAL_ERROR
4587
4595
      {
4588
 
        char buf[ERRMSGSIZE+20];
4589
 
        uint length=my_snprintf(buf, ERRMSGSIZE,
 
4596
        char buf[MYSQL_ERRMSG_SIZE];
 
4597
        size_t length=my_snprintf(buf, sizeof(buf),
4590
4598
                                "Unknown - internal error %d during operation",
4591
4599
                                result_code);
4592
4600
        protocol->store(STRING_WITH_LEN("error"), system_charset_info);
4638
4646
bool mysql_backup_table(THD* thd, TABLE_LIST* table_list)
4639
4647
{
4640
4648
  DBUG_ENTER("mysql_backup_table");
4641
 
  WARN_DEPRECATED(thd, "5.2", "BACKUP TABLE",
 
4649
  WARN_DEPRECATED(thd, "6.0", "BACKUP TABLE",
4642
4650
                  "MySQL Administrator (mysqldump, mysql)");
4643
4651
  DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
4644
4652
                                "backup", TL_READ, 0, 0, 0, 0,
4649
4657
bool mysql_restore_table(THD* thd, TABLE_LIST* table_list)
4650
4658
{
4651
4659
  DBUG_ENTER("mysql_restore_table");
4652
 
  WARN_DEPRECATED(thd, "5.2", "RESTORE TABLE",
 
4660
  WARN_DEPRECATED(thd, "6.0", "RESTORE TABLE",
4653
4661
                  "MySQL Administrator (mysqldump, mysql)");
4654
4662
  DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
4655
4663
                                "restore", TL_WRITE, 1, 1, 0,
4983
4991
                                dst_path); /* purecov: inspected */
4984
4992
      goto err;     /* purecov: inspected */
4985
4993
    }
 
4994
    thd->thread_specific_used= TRUE;
4986
4995
  }
4987
4996
  else if (err)
4988
4997
  {