Commit 9ec326a8 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup frm creation:

* comments
* cosmetic changes, *(ptr+5) -> ptr[5]
* a couple of trivial functions -> inline
* remove unused argument from pack_header()
* create_frm() no longer creates frm file (the function used to prepare and
  fill a memory buffer and call my_create at the end. Now it only prepares
  a memory buffer). Renamed accordingly.
* don't call pack_screen twice, go for a smaller screen area in the first attempt
* remove useless calls to check_duplicate_warning()
* don't write unireg screens to .frm files
* remove make_new_entry(), it's basically dead code, always calculating
  and writing into frm the same string value. replace the function call
  with the constant string.
parent 84b88217
...@@ -12701,12 +12701,12 @@ CREATE TABLE t1(a INT, b BLOB) ENGINE=archive; ...@@ -12701,12 +12701,12 @@ CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH DATA_LENGTH AVG_ROW_LENGTH
8666 15 8608 15
INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2'); INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH DATA_LENGTH AVG_ROW_LENGTH
8700 4350 8642 4321
DROP TABLE t1; DROP TABLE t1;
SET @save_join_buffer_size= @@join_buffer_size; SET @save_join_buffer_size= @@join_buffer_size;
SET @@join_buffer_size= 8192; SET @@join_buffer_size= 8192;
......
...@@ -15,10 +15,10 @@ ENGINE = ARCHIVE; ...@@ -15,10 +15,10 @@ ENGINE = ARCHIVE;
INSERT INTO t1 VALUES(CURRENT_DATE); INSERT INTO t1 VALUES(CURRENT_DATE);
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DATA_LENGTH INDEX_LENGTH DATA_LENGTH INDEX_LENGTH
8658 0 8604 0
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DATA_LENGTH INDEX_LENGTH DATA_LENGTH INDEX_LENGTH
8658 0 8604 0
DROP TABLE t1; DROP TABLE t1;
drop database if exists db99; drop database if exists db99;
drop table if exists t1; drop table if exists t1;
......
...@@ -2383,7 +2383,7 @@ class Create_field :public Sql_alloc ...@@ -2383,7 +2383,7 @@ class Create_field :public Sql_alloc
/** structure with parsed options (for comparing fields in ALTER TABLE) */ /** structure with parsed options (for comparing fields in ALTER TABLE) */
ha_field_option_struct *option_struct; ha_field_option_struct *option_struct;
uint8 row,col,sc_length,interval_id; // For rea_create_table uint8 interval_id; // For rea_create_table
uint offset,pack_flag; uint offset,pack_flag;
/* /*
......
This diff is collapsed.
...@@ -2490,17 +2490,28 @@ bool get_field(MEM_ROOT *mem, Field *field, class String *res); ...@@ -2490,17 +2490,28 @@ bool get_field(MEM_ROOT *mem, Field *field, class String *res);
int closefrm(TABLE *table, bool free_share); int closefrm(TABLE *table, bool free_share);
void free_blobs(TABLE *table); void free_blobs(TABLE *table);
void free_field_buffers_larger_than(TABLE *table, uint32 size); void free_field_buffers_larger_than(TABLE *table, uint32 size);
int set_zone(int nr,int min_zone,int max_zone);
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names); ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
const char *newname);
ulong next_io_size(ulong pos);
void append_unescaped(String *res, const char *pos, uint length); void append_unescaped(String *res, const char *pos, uint length);
File create_frm(THD *thd, const char *name, const char *db, void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
const char *table, uint reclength, uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
char *fn_rext(char *name); char *fn_rext(char *name);
/* Check that the integer is in the internal */
static inline int set_zone(int nr,int min_zone,int max_zone)
{
if (nr <= min_zone)
return min_zone;
if (nr >= max_zone)
return max_zone;
return nr;
}
/* Adjust number to next larger disk buffer */
static inline ulong next_io_size(ulong pos)
{
return MY_ALIGN(pos, IO_SIZE);
}
/* performance schema */ /* performance schema */
extern LEX_STRING PERFORMANCE_SCHEMA_DB_NAME; extern LEX_STRING PERFORMANCE_SCHEMA_DB_NAME;
......
This diff is collapsed.
...@@ -179,6 +179,9 @@ int rea_create_table(THD *thd, const char *path, ...@@ -179,6 +179,9 @@ int rea_create_table(THD *thd, const char *path,
uint key_count,KEY *key_info, uint key_count,KEY *key_info,
handler *file); handler *file);
#define FRM_HEADER_SIZE 64
#define FRM_FORMINFO_SIZE 288
static inline bool is_binary_frm_header(uchar *head) static inline bool is_binary_frm_header(uchar *head)
{ {
return head[0] == 254 return head[0] == 254
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment