~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_show.cc

  • Committer: Paul McCullagh
  • Date: 2008-10-10 12:42:11 UTC
  • mfrom: (499 drizzle)
  • mto: (499.1.1 codestyle)
  • mto: This revision was merged to the branch mainline in revision 505.
  • Revision ID: paul.mccullagh@primebase.org-20081010124211-hxs9ny96auxpq2ag
Merged trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <drizzled/sql_show.h>
21
21
#include <mysys/my_dir.h>
22
22
#include <libdrizzle/gettext.h>
 
23
#include <drizzled/util/convert.h>
 
24
#include <string>
23
25
 
24
26
inline const char *
25
27
str_or_nil(const char *str)
653
655
                      HA_CREATE_INFO *create_info_arg)
654
656
{
655
657
  List<Item> field_list;
656
 
  char tmp[MAX_FIELD_WIDTH], *for_str, buff[128], def_value_buf[MAX_FIELD_WIDTH];
 
658
  char tmp[MAX_FIELD_WIDTH], *for_str, def_value_buf[MAX_FIELD_WIDTH];
657
659
  const char *alias;
 
660
  std::string buff;
658
661
  String type(tmp, sizeof(tmp), system_charset_info);
659
662
  String def_value(def_value_buf, sizeof(def_value_buf), system_charset_info);
660
663
  Field **ptr,*field;
825
828
          (key_part->length !=
826
829
           table->field[key_part->fieldnr-1]->key_length()))
827
830
      {
828
 
        char *end;
829
 
        buff[0] = '(';
830
 
        end= int10_to_str((long) key_part->length /
831
 
                          key_part->field->charset()->mbmaxlen,
832
 
                          buff + 1,10);
833
 
        *end++ = ')';
834
 
        packet->append(buff,(uint) (end-buff));
 
831
        buff= "(";
 
832
        buff= to_string(buff, (int32_t) key_part->length /
 
833
                              key_part->field->charset()->mbmaxlen);
 
834
        buff += ")";
 
835
        packet->append(buff.c_str(), buff.length());
835
836
      }
836
837
    }
837
838
    packet->append(')');
881
882
 
882
883
    if (create_info.auto_increment_value > 1)
883
884
    {
884
 
      char *end;
885
885
      packet->append(STRING_WITH_LEN(" AUTO_INCREMENT="));
886
 
      end= int64_t10_to_str(create_info.auto_increment_value, buff,10);
887
 
      packet->append(buff, (uint) (end - buff));
 
886
      buff= to_string(create_info.auto_increment_value);
 
887
      packet->append(buff.c_str(), buff.length());
888
888
    }
889
889
 
890
890
    if (share->min_rows)
891
891
    {
892
 
      char *end;
893
892
      packet->append(STRING_WITH_LEN(" MIN_ROWS="));
894
 
      end= int64_t10_to_str(share->min_rows, buff, 10);
895
 
      packet->append(buff, (uint) (end- buff));
 
893
      buff= to_string(share->min_rows);
 
894
      packet->append(buff.c_str(), buff.length());
896
895
    }
897
896
 
898
897
    if (share->max_rows && !table_list->schema_table)
899
898
    {
900
 
      char *end;
901
899
      packet->append(STRING_WITH_LEN(" MAX_ROWS="));
902
 
      end= int64_t10_to_str(share->max_rows, buff, 10);
903
 
      packet->append(buff, (uint) (end - buff));
 
900
      buff= to_string(share->max_rows);
 
901
      packet->append(buff.c_str(), buff.length());
904
902
    }
905
903
 
906
904
    if (share->avg_row_length)
907
905
    {
908
 
      char *end;
909
906
      packet->append(STRING_WITH_LEN(" AVG_ROW_LENGTH="));
910
 
      end= int64_t10_to_str(share->avg_row_length, buff,10);
911
 
      packet->append(buff, (uint) (end - buff));
 
907
      buff= to_string(share->avg_row_length);
 
908
      packet->append(buff.c_str(), buff.length());
912
909
    }
913
910
 
914
911
    if (share->db_create_options & HA_OPTION_PACK_KEYS)
937
934
    }
938
935
    if (table->s->key_block_size)
939
936
    {
940
 
      char *end;
941
937
      packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
942
 
      end= int64_t10_to_str(table->s->key_block_size, buff, 10);
943
 
      packet->append(buff, (uint) (end - buff));
 
938
      buff= to_string(table->s->key_block_size);
 
939
      packet->append(buff.c_str(), buff.length());
944
940
    }
945
941
    if (share->block_size)
946
942
    {
947
 
      char *end;
948
943
      packet->append(STRING_WITH_LEN(" BLOCK_SIZE="));
949
 
      end= int64_t10_to_str(share->block_size, buff,10);
950
 
      packet->append(buff, (uint) (end - buff));
 
944
      buff= to_string(share->block_size);
 
945
      packet->append(buff.c_str(), buff.length());
951
946
    }
952
947
    table->file->append_create_info(packet);
953
948
    if (share->comment.length)