~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Brian Aker
  • Date: 2008-08-05 04:10:42 UTC
  • mfrom: (261.2.8 codestyle)
  • mto: This revision was merged to the branch mainline in revision 263.
  • Revision ID: brian@tangent.org-20080805041042-1l4893r3bwy2lxz2
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
470
470
    {
471
471
      // Table was not found on disk and table can't be created from engine
472
472
      if (if_exists)
473
 
        push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
473
        push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
474
474
                            ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
475
475
                            table->table_name);
476
476
      else
1472
1472
            if (key->type == Key::MULTIPLE)
1473
1473
            {
1474
1474
              /* not a critical problem */
1475
 
              char warn_buff[MYSQL_ERRMSG_SIZE];
 
1475
              char warn_buff[DRIZZLE_ERRMSG_SIZE];
1476
1476
              snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_KEY),
1477
1477
                       length);
1478
 
              push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
1478
              push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1479
1479
                           ER_TOO_LONG_KEY, warn_buff);
1480
1480
              /* Align key length to multibyte char boundary */
1481
1481
              length-= length % sql_field->charset->mbmaxlen;
1511
1511
        if (key->type == Key::MULTIPLE)
1512
1512
        {
1513
1513
          /* not a critical problem */
1514
 
          char warn_buff[MYSQL_ERRMSG_SIZE];
 
1514
          char warn_buff[DRIZZLE_ERRMSG_SIZE];
1515
1515
          snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_KEY),
1516
1516
                   length);
1517
 
          push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 
1517
          push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1518
1518
                       ER_TOO_LONG_KEY, warn_buff);
1519
1519
          /* Align key length to multibyte char boundary */
1520
1520
          length-= length % sql_field->charset->mbmaxlen;
1856
1856
    if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
1857
1857
    {
1858
1858
      create_info->table_existed= 1;            // Mark that table existed
1859
 
      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
1859
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
1860
1860
                          ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
1861
1861
                          alias);
1862
1862
      error= 0;
1942
1942
#endif /* HAVE_READLINK */
1943
1943
  {
1944
1944
    if (create_info->data_file_name)
1945
 
      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
 
1945
      push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
1946
1946
                   "DATA DIRECTORY option ignored");
1947
1947
    if (create_info->index_file_name)
1948
 
      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
 
1948
      push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 0,
1949
1949
                   "INDEX DIRECTORY option ignored");
1950
1950
    create_info->data_file_name= create_info->index_file_name= 0;
1951
1951
  }
1991
1991
 
1992
1992
warn:
1993
1993
  error= false;
1994
 
  push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
1994
  push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
1995
1995
                      ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
1996
1996
                      alias);
1997
1997
  create_info->table_existed= 1;                // Mark that table existed
2040
2040
    {
2041
2041
      if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
2042
2042
      {
2043
 
        push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
2043
        push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
2044
2044
                            ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
2045
2045
                            table_name);
2046
2046
        create_info->table_existed= 1;
2538
2538
    if (!table->table)
2539
2539
    {
2540
2540
      if (!thd->warn_list.elements)
2541
 
        push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
 
2541
        push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
2542
2542
                     ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
2543
2543
      goto send_result;
2544
2544
    }
2546
2546
    if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
2547
2547
    {
2548
2548
      /* purecov: begin inspected */
2549
 
      char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
 
2549
      char buff[FN_REFLEN + DRIZZLE_ERRMSG_SIZE];
2550
2550
      uint length;
2551
2551
      protocol->prepare_for_resend();
2552
2552
      protocol->store(table_name, system_charset_info);
2628
2628
    lex->cleanup_after_one_table_open();
2629
2629
    thd->clear_error();  // these errors shouldn't get client
2630
2630
    {
2631
 
      List_iterator_fast<MYSQL_ERROR> it(thd->warn_list);
2632
 
      MYSQL_ERROR *err;
 
2631
      List_iterator_fast<DRIZZLE_ERROR> it(thd->warn_list);
 
2632
      DRIZZLE_ERROR *err;
2633
2633
      while ((err= it++))
2634
2634
      {
2635
2635
        protocol->prepare_for_resend();
2642
2642
        if (protocol->write())
2643
2643
          goto err;
2644
2644
      }
2645
 
      mysql_reset_errors(thd, true);
 
2645
      drizzle_reset_errors(thd, true);
2646
2646
    }
2647
2647
    protocol->prepare_for_resend();
2648
2648
    protocol->store(table_name, system_charset_info);
2950
2950
  uint keys= schema_table->table->s->keys;
2951
2951
  uint db_options= 0;
2952
2952
 
2953
 
  memset((char*) &local_create_info, 0, sizeof(local_create_info));
 
2953
  memset(&local_create_info, 0, sizeof(local_create_info));
2954
2954
  local_create_info.db_type= schema_table->table->s->db_type();
2955
2955
  local_create_info.row_type= schema_table->table->s->row_type;
2956
2956
  local_create_info.default_table_charset=default_charset_info;
3168
3168
table_exists:
3169
3169
  if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
3170
3170
  {
3171
 
    char warn_buff[MYSQL_ERRMSG_SIZE];
 
3171
    char warn_buff[DRIZZLE_ERRMSG_SIZE];
3172
3172
    snprintf(warn_buff, sizeof(warn_buff),
3173
3173
             ER(ER_TABLE_EXISTS_ERROR), table_name);
3174
 
    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
3174
    push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
3175
3175
                 ER_TABLE_EXISTS_ERROR,warn_buff);
3176
3176
    res= false;
3177
3177
  }
3719
3719
 
3720
3720
  if (error == HA_ERR_WRONG_COMMAND)
3721
3721
  {
3722
 
    push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
3722
    push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
3723
3723
                        ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
3724
3724
                        table->s->table_name.str);
3725
3725
    error= 0;
4315
4315
      KEY_CREATE_INFO key_create_info;
4316
4316
      Key *key;
4317
4317
      enum Key::Keytype key_type;
4318
 
      memset((char*) &key_create_info, 0, sizeof(key_create_info));
 
4318
      memset(&key_create_info, 0, sizeof(key_create_info));
4319
4319
 
4320
4320
      key_create_info.algorithm= key_info->algorithm;
4321
4321
      if (key_info->flags & HA_USES_BLOCK_SIZE)
4645
4645
    if (error == HA_ERR_WRONG_COMMAND)
4646
4646
    {
4647
4647
      error= 0;
4648
 
      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
4648
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
4649
4649
                          ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
4650
4650
                          table->alias);
4651
4651
    }
4698
4698
    if (error == HA_ERR_WRONG_COMMAND)
4699
4699
  {
4700
4700
      error= 0;
4701
 
      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
4701
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
4702
4702
                          ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
4703
4703
                          table->alias);
4704
4704
  }
4890
4890
  if (table->s->tmp_table)
4891
4891
  {
4892
4892
    TABLE_LIST tbl;
4893
 
    memset((void*) &tbl, 0, sizeof(tbl));
 
4893
    memset(&tbl, 0, sizeof(tbl));
4894
4894
    tbl.db= new_db;
4895
4895
    tbl.table_name= tbl.alias= tmp_name;
4896
4896
    /* Table is in thd->temporary_tables */
5150
5150
    }
5151
5151
    bool save_abort_on_warning= thd->abort_on_warning;
5152
5152
    thd->abort_on_warning= true;
5153
 
    make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
 
5153
    make_truncated_value_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
5154
5154
                                 f_val, strlength(f_val), t_type,
5155
5155
                                 alter_info->datetime_field->field_name);
5156
5156
    thd->abort_on_warning= save_abort_on_warning;
5260
5260
  {
5261
5261
    if (to->s->primary_key != MAX_KEY && to->file->primary_key_is_clustered())
5262
5262
    {
5263
 
      char warn_buff[MYSQL_ERRMSG_SIZE];
 
5263
      char warn_buff[DRIZZLE_ERRMSG_SIZE];
5264
5264
      snprintf(warn_buff, sizeof(warn_buff), 
5265
5265
               "ORDER BY ignored as there is a user-defined clustered index"
5266
5266
               " in the table '%-.192s'", from->s->table_name.str);
5267
 
      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
 
5267
      push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
5268
5268
                   warn_buff);
5269
5269
    }
5270
5270
    else
5271
5271
    {
5272
5272
      from->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
5273
5273
                                                MYF(MY_FAE | MY_ZEROFILL));
5274
 
      memset((char *) &tables, 0, sizeof(tables));
 
5274
      memset(&tables, 0, sizeof(tables));
5275
5275
      tables.table= from;
5276
5276
      tables.alias= tables.table_name= from->s->table_name.str;
5277
5277
      tables.db= from->s->db.str;
5417
5417
  */
5418
5418
  table_list->table= NULL;
5419
5419
 
5420
 
  memset((char*) &create_info, 0, sizeof(create_info));
 
5420
  memset(&create_info, 0, sizeof(create_info));
5421
5421
  create_info.row_type=ROW_TYPE_NOT_USED;
5422
5422
  create_info.default_table_charset=default_charset_info;
5423
5423
  /* Force alter table to recreate table */
5556
5556
 
5557
5557
  if (req_engine && req_engine != *new_engine)
5558
5558
  {
5559
 
    push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
5559
    push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
5560
5560
                       ER_WARN_USING_OTHER_HANDLER,
5561
5561
                       ER(ER_WARN_USING_OTHER_HANDLER),
5562
5562
                       ha_resolve_storage_engine_name(*new_engine),