~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: Toru Maesaka
  • Date: 2009-02-16 14:08:16 UTC
  • mto: (873.2.32 devel)
  • mto: This revision was merged to the branch mainline in revision 888.
  • Revision ID: dev@torum.net-20090216140816-pzt8s29bfjacfve3
Fixed the bug of SHOW CREATE TABLE not outputting DEFAULT values. Killed some tabular indents on the way too

Show diffs side-by-side

added added

removed removed

Lines of Context:
307
307
      file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
308
308
      if (wild)
309
309
      {
310
 
        if (lower_case_table_names)
311
 
        {
312
 
          if (wild_case_compare(files_charset_info, uname, wild))
313
 
            continue;
314
 
        }
315
 
        else if (wild_compare(uname, wild, 0))
316
 
          continue;
 
310
        if (lower_case_table_names)
 
311
        {
 
312
          if (wild_case_compare(files_charset_info, uname, wild))
 
313
            continue;
 
314
        }
 
315
        else if (wild_compare(uname, wild, 0))
 
316
          continue;
317
317
      }
318
318
    }
319
319
    if (!(file_name=
330
330
}
331
331
 
332
332
 
333
 
bool
334
 
mysqld_show_create(Session *session, TableList *table_list)
 
333
bool drizzled_show_create(Session *session, TableList *table_list)
335
334
{
336
335
  Protocol *protocol= session->protocol;
337
336
  char buff[2048];
367
366
 
368
367
  if (protocol->send_fields(&field_list,
369
368
                            Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
 
369
  {
370
370
    return(true);
 
371
  }
371
372
  protocol->prepare_for_resend();
372
373
  {
373
374
    if (table_list->schema_table)
523
524
 
524
525
  has_default= (field->type() != DRIZZLE_TYPE_BLOB &&
525
526
                !(field->flags & NO_DEFAULT_VALUE_FLAG) &&
526
 
                field->unireg_check != Field::NEXT_NUMBER
527
 
                  && has_now_default);
 
527
                field->unireg_check != Field::NEXT_NUMBER);
528
528
 
529
529
  def_value->length(0);
530
530
  if (has_default)
555
555
      def_value->append(STRING_WITH_LEN("NULL"));    // Null as default
556
556
    else
557
557
      return 0;
558
 
 
559
558
  }
560
559
  return has_default;
561
560
}
618
617
    if (lower_case_table_names == 2)
619
618
      alias= table->alias;
620
619
    else
621
 
    {
622
620
      alias= share->table_name.str;
623
 
    }
624
621
  }
625
622
  packet->append_identifier(alias, strlen(alias));
626
623
  packet->append(STRING_WITH_LEN(" (\n"));
670
667
    {
671
668
      if (field->charset() != share->table_charset)
672
669
      {
673
 
        packet->append(STRING_WITH_LEN(" CHARACTER SET "));
674
 
        packet->append(field->charset()->csname);
 
670
        packet->append(STRING_WITH_LEN(" CHARACTER SET "));
 
671
        packet->append(field->charset()->csname);
675
672
      }
 
673
 
676
674
      /*
677
 
        For string types dump collation name only if
678
 
        collation is not primary for the given charset
 
675
        For string types dump collation name only if
 
676
        collation is not primary for the given charset
679
677
      */
680
678
      if (!(field->charset()->state & MY_CS_PRIMARY))
681
679
      {
682
 
        packet->append(STRING_WITH_LEN(" COLLATE "));
683
 
        packet->append(field->charset()->name);
 
680
        packet->append(STRING_WITH_LEN(" COLLATE "));
 
681
        packet->append(field->charset()->name);
684
682
      }
685
683
    }
686
684
 
772
770
 
773
771
      if (key_part->field)
774
772
        packet->append_identifier(key_part->field->field_name,
775
 
                          strlen(key_part->field->field_name));
 
773
                                  strlen(key_part->field->field_name));
776
774
      if (key_part->field &&
777
775
          (key_part->length !=
778
776
           table->field[key_part->fieldnr-1]->key_length()))