Commit 2350609b authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fixed that SHOW CREATE TABLE shows all attributes

parent 34c3484f
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -33982,14 +33982,14 @@ reference_option:
        RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT
table_options:
	TYPE = @{BDB | HEAP | ISAM | InnoDB | MERGE | MYISAM @}
	TYPE = @{BDB | HEAP | ISAM | InnoDB | MERGE | MRG_MYISAM | MYISAM @}
or	AUTO_INCREMENT = #
or	AVG_ROW_LENGTH = #
or	CHECKSUM = @{0 | 1@}
or	COMMENT = "string"
or	MAX_ROWS = #
or	MIN_ROWS = #
or	PACK_KEYS = @{0 | 1@}
or	PACK_KEYS = @{0 | 1 | DEFAULT@}
or	PASSWORD = "string"
or	DELAY_KEY_WRITE = @{0 | 1@}
or      ROW_FORMAT= @{ default | dynamic | fixed | compressed @}
@@ -34229,6 +34229,7 @@ The different table types are:
@item ISAM @tab The original table handler. @xref{ISAM}.
@item InnoDB @tab Transaction-safe tables with row locking. @xref{InnoDB}.
@item MERGE @tab A collection of MyISAM tables used as one table. @xref{MERGE}.
@item MRG_MERGE @tab An alias for MERGE tables
@item MyISAM @tab The new binary portable table handler that is replacing ISAM. @xref{MyISAM}.
@end multitable
@xref{Table types}.
@@ -34250,7 +34251,7 @@ The options work for all table types, if not otherwise indicated:
@item @code{COMMENT} @tab A 60-character comment for your table.
@item @code{MAX_ROWS} @tab Max number of rows you plan to store in the table.
@item @code{MIN_ROWS} @tab Minimum number of rows you plan to store in the table.
@item @code{PACK_KEYS} @tab Set this to 1 if you want to have a smaller index. This usually makes updates slower and reads faster (MyISAM, ISAM).
@item @code{PACK_KEYS} @tab Set this to 1 if you want to have a smaller index. This usually makes updates slower and reads faster (MyISAM, ISAM). Setting this to 0 will disable all packing of keys. Setting this to @code{DEFAULT} (MySQL 4.0) will tell the table handler to only pack long @code{CHAR}/@code{VARCHAR} columns.
@item @code{PASSWORD} @tab Encrypt the @code{.frm} file with a password.  This option doesn't do anything in the standard MySQL version.
@item @code{DELAY_KEY_WRITE} @tab Set this to 1 if want to delay key table updates until the table is closed (MyISAM).
@item @code{ROW_FORMAT} @tab Defines how the rows should be stored. Currently this option only works with MyISAM tables, which supports the @code{DYNAMIC} and @code{FIXED} row formats. @xref{MyISAM table formats}.
@@ -36070,11 +36071,11 @@ is not signaled to the other servers.
@code{MERGE} tables are new in MySQL Version 3.23.25. The code
is still in gamma, but should be resonable stable.
A @code{MERGE} table is a collection of identical @code{MyISAM} tables
that can be used as one.  You can only @code{SELECT}, @code{DELETE}, and
@code{UPDATE} from the collection of tables.  If you @code{DROP} the
@code{MERGE} table, you are only dropping the @code{MERGE}
specification.
A @code{MERGE} table (also known as a @code{MRG_MyISAM} table) is a
collection of identical @code{MyISAM} tables that can be used as one.
You can only @code{SELECT}, @code{DELETE}, and @code{UPDATE} from the
collection of tables.  If you @code{DROP} the @code{MERGE} table, you
are only dropping the @code{MERGE} specification.
Note that @code{DELETE FROM merge_table} used without a @code{WHERE}
will only clear the mapping for the table, not delete everything in the
@@ -47709,6 +47710,8 @@ Searching on packed (@code{CHAR}/@code{VARCHAR}) keys are now much faster.
Optimized queries of type:
@code{SELECT DISTINCT * from table_name ORDER by key_part1 LIMIT #}
@item
@code{SHOW CREATE TABLE} now shows all table attributes.
@item
@code{ORDER BY ... DESC} can now use keys.
@item
@code{LOAD DATA FROM MASTER} "auto-magically" sets up a slave.
+18 −0
Original line number Diff line number Diff line
@@ -93,3 +93,21 @@ t1 CREATE TABLE `t1` (
Database	Table	In_use	Name_locked
Database	Table	In_use	Name_locked
test	t1	0	0
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL default '0',
  `b` char(10) default NULL,
  KEY `b` (`b`)
) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL default '0',
  `b` varchar(10) default NULL,
  KEY `b` (`b`)
) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL default '0',
  `b` varchar(10) default NULL,
  KEY `b` (`b`)
) TYPE=MyISAM
+8 −0
Original line number Diff line number Diff line
@@ -79,3 +79,11 @@ create table t1(n int);
insert into t1 values (1);
show open tables;
drop table t1;

create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
show create table t1;
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
show create table t1;
ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default;
show create table t1;
drop table t1;
+6 −2
Original line number Diff line number Diff line
@@ -114,8 +114,8 @@ enum db_type { DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1,
	       DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB, DB_TYPE_GEMINI,
	       DB_TYPE_DEFAULT };

enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC,
	        ROW_TYPE_COMPRESSED };
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
		ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED};

/* struct to hold information about the table that should be created */

@@ -124,6 +124,10 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC,
#define HA_CREATE_USED_RAID		2
#define HA_CREATE_USED_UNION		4
#define HA_CREATE_USED_INSERT_METHOD	8
#define HA_CREATE_USED_MIN_ROWS		16
#define HA_CREATE_USED_MAX_ROWS		32
#define HA_CREATE_USED_AVG_ROW_LENGTH	64
#define HA_CREATE_USED_PACK_KEYS	128

typedef struct st_thd_trans {
  void *bdb_tid;
+12 −1
Original line number Diff line number Diff line
@@ -390,7 +390,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
        if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
          ptr=strmov(ptr," delay_key_write=1");
        if (table->row_type != ROW_TYPE_DEFAULT)
          ptr=strxmov(ptr, " format=", ha_row_type[(uint) table->row_type],
          ptr=strxmov(ptr, " row_format=", ha_row_type[(uint) table->row_type],
                      NullS);
        if (file->raid_type)
        {
@@ -919,6 +919,12 @@ store_create_info(THD *thd, TABLE *table, String *packet)
    p = longlong10_to_str(table->max_rows, buff, 10);
    packet->append(buff, (uint) (p - buff));
  }
  if (table->avg_row_length)
  {
    packet->append(" AVG_ROW_LENGTH=");
    p=longlong10_to_str(table->avg_row_length, buff,10);
    packet->append(buff, (uint) (p - buff));
  }

  if (table->db_create_options & HA_OPTION_PACK_KEYS)
    packet->append(" PACK_KEYS=1", 12);
@@ -928,6 +934,11 @@ store_create_info(THD *thd, TABLE *table, String *packet)
    packet->append(" CHECKSUM=1", 11);
  if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
    packet->append(" DELAY_KEY_WRITE=1",18);
  if (table->row_type != ROW_TYPE_DEFAULT)
  {
    packet->append(" ROW_FORMAT=",12);
    packet->append(ha_row_type[(uint) table->row_type]);
  }
  table->file->append_create_info(packet);
  if (table->comment && table->comment[0])
  {
Loading