Commit ffbd15eb authored by Sergei Golubchik's avatar Sergei Golubchik

post-review comments and other minor edits

parent 7ec57f22
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
/* /*
Maximum length of comments Maximum length of comments
*/ */
#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */ #define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 5.5: 60 characters */
#define TABLE_COMMENT_MAXLEN 2048 #define TABLE_COMMENT_MAXLEN 2048
#define COLUMN_COMMENT_MAXLEN 1024 #define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024 #define INDEX_COMMENT_MAXLEN 1024
......
...@@ -111,17 +111,21 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len) ...@@ -111,17 +111,21 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len)
*/ */
int writefrm(const char *path, const char *db, const char *table, int writefrm(const char *path, const char *db, const char *table,
bool need_sync, const uchar *frmdata, size_t len) bool tmp_table, const uchar *frmdata, size_t len)
{ {
char file_name[FN_REFLEN+1]; char file_name[FN_REFLEN+1];
int error; int error;
int create_flags= O_RDWR | O_TRUNC;
DBUG_ENTER("writefrm"); DBUG_ENTER("writefrm");
DBUG_PRINT("enter",("name: '%s' len: %lu ",path, (ulong) len)); DBUG_PRINT("enter",("name: '%s' len: %lu ",path, (ulong) len));
if (tmp_table)
create_flags|= O_EXCL | O_NOFOLLOW;
strxnmov(file_name, sizeof(file_name)-1, path, reg_ext, NullS); strxnmov(file_name, sizeof(file_name)-1, path, reg_ext, NullS);
File file= mysql_file_create(key_file_frm, file_name, File file= mysql_file_create(key_file_frm, file_name,
CREATE_MODE, O_RDWR | O_TRUNC, MYF(0)); CREATE_MODE, create_flags, MYF(0));
if ((error= file < 0)) if ((error= file < 0))
{ {
...@@ -134,7 +138,7 @@ int writefrm(const char *path, const char *db, const char *table, ...@@ -134,7 +138,7 @@ int writefrm(const char *path, const char *db, const char *table,
{ {
error= mysql_file_write(file, frmdata, len, MYF(MY_WME | MY_NABP)); error= mysql_file_write(file, frmdata, len, MYF(MY_WME | MY_NABP));
if (!error && need_sync && opt_sync_frm) if (!error && !tmp_table && opt_sync_frm)
error= mysql_file_sync(file, MYF(MY_WME)) || error= mysql_file_sync(file, MYF(MY_WME)) ||
my_sync_dir_by_file(file_name, MYF(MY_WME)); my_sync_dir_by_file(file_name, MYF(MY_WME));
......
...@@ -24,7 +24,7 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext, ...@@ -24,7 +24,7 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext,
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
int readfrm(const char *name, const uchar **data, size_t *length); int readfrm(const char *name, const uchar **data, size_t *length);
int writefrm(const char *path, const char *db, const char *table, int writefrm(const char *path, const char *db, const char *table,
bool need_sync, const uchar *frmdata, size_t len); bool tmp_table, const uchar *frmdata, size_t len);
int ext_table_discovery_simple(MY_DIR *dirp, int ext_table_discovery_simple(MY_DIR *dirp,
handlerton::discovered_list *result); handlerton::discovered_list *result);
......
...@@ -6192,9 +6192,9 @@ ER_TOO_LONG_TABLE_COMMENT ...@@ -6192,9 +6192,9 @@ ER_TOO_LONG_TABLE_COMMENT
por "Comentário para a tabela '%-.64s' é longo demais (max = %u)" por "Comentário para a tabela '%-.64s' é longo demais (max = %u)"
ger "Kommentar für Tabelle '%-.64s' ist zu lang (max = %u)" ger "Kommentar für Tabelle '%-.64s' ist zu lang (max = %u)"
ER_TOO_LONG_FIELD_COMMENT ER_TOO_LONG_FIELD_COMMENT
eng "Comment for field '%-.64s' is too long (max = %lu)" eng "Comment for field '%-.64s' is too long (max = %u)"
por "Comentário para o campo '%-.64s' é longo demais (max = %lu)" por "Comentário para o campo '%-.64s' é longo demais (max = %u)"
ger "Kommentar für Feld '%-.64s' ist zu lang (max = %lu)" ger "Kommentar für Feld '%-.64s' ist zu lang (max = %u)"
ER_FUNC_INEXISTENT_NAME_COLLISION 42000 ER_FUNC_INEXISTENT_NAME_COLLISION 42000
eng "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual" eng "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual"
ger "FUNCTION %s existiert nicht. Erläuterungen im Abschnitt 'Function Name Parsing and Resolution' im Referenzhandbuch" ger "FUNCTION %s existiert nicht. Erläuterungen im Abschnitt 'Function Name Parsing and Resolution' im Referenzhandbuch"
......
...@@ -1709,7 +1709,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) ...@@ -1709,7 +1709,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
} }
int error= writefrm(shadow_path, lpt->db, lpt->table_name, int error= writefrm(shadow_path, lpt->db, lpt->table_name,
!lpt->create_info->tmp_table(), frm.str, frm.length); lpt->create_info->tmp_table(), frm.str, frm.length);
my_free(const_cast<uchar*>(frm.str)); my_free(const_cast<uchar*>(frm.str));
if (error || lpt->table->file->ha_create_partitioning_metadata(shadow_path, if (error || lpt->table->file->ha_create_partitioning_metadata(shadow_path,
...@@ -1751,7 +1751,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) ...@@ -1751,7 +1751,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
*/ */
build_table_filename(path, sizeof(path) - 1, lpt->db, build_table_filename(path, sizeof(path) - 1, lpt->db,
lpt->table_name, "", 0); lpt->table_name, "", 0);
strxmov(frm_name, path, reg_ext, NullS); strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
/* /*
When we are changing to use new frm file we need to ensure that we When we are changing to use new frm file we need to ensure that we
don't collide with another thread in process to open the frm file. don't collide with another thread in process to open the frm file.
...@@ -4467,7 +4467,7 @@ bool mysql_create_table_no_lock(THD *thd, ...@@ -4467,7 +4467,7 @@ bool mysql_create_table_no_lock(THD *thd,
create_info, file)) create_info, file))
{ {
char frm_name[FN_REFLEN]; char frm_name[FN_REFLEN];
strxmov(frm_name, path, reg_ext, NullS); strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
(void) mysql_file_delete(key_file_frm, frm_name, MYF(0)); (void) mysql_file_delete(key_file_frm, frm_name, MYF(0));
goto err; goto err;
} }
...@@ -6661,7 +6661,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -6661,7 +6661,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (need_copy_table == ALTER_TABLE_METADATA_ONLY) if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
{ {
char frm_name[FN_REFLEN+1]; char frm_name[FN_REFLEN+1];
strxmov(frm_name, path, reg_ext, NullS); strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
/* /*
C_ALTER_TABLE_FRM_ONLY can only be used if old frm exists. C_ALTER_TABLE_FRM_ONLY can only be used if old frm exists.
discovering frm-less engines cannot enjoy this optimization. discovering frm-less engines cannot enjoy this optimization.
......
...@@ -592,11 +592,10 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags) ...@@ -592,11 +592,10 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
{ {
bool error_given= false; bool error_given= false;
File file; File file;
MY_STAT stats;
uchar *buf; uchar *buf;
uchar head[FRM_HEADER_SIZE]; uchar head[FRM_HEADER_SIZE];
char path[FN_REFLEN]; char path[FN_REFLEN];
size_t frmlen; size_t frmlen, read_length;
DBUG_ENTER("open_table_def"); DBUG_ENTER("open_table_def");
DBUG_PRINT("enter", ("table: '%s'.'%s' path: '%s'", share->db.str, DBUG_PRINT("enter", ("table: '%s'.'%s' path: '%s'", share->db.str,
share->table_name.str, share->normalized_path.str)); share->table_name.str, share->normalized_path.str));
...@@ -640,26 +639,26 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags) ...@@ -640,26 +639,26 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
goto err; goto err;
} }
if (my_fstat(file, &stats, MYF(0))) frmlen= uint4korr(head+10);
goto err; set_if_smaller(frmlen, FRM_MAX_SIZE); // safety
frmlen= min(FRM_MAX_SIZE, stats.st_size); // safety
if (!(buf= (uchar*)my_malloc(frmlen, MYF(MY_THREAD_SPECIFIC|MY_WME)))) if (!(buf= (uchar*)my_malloc(frmlen, MYF(MY_THREAD_SPECIFIC|MY_WME))))
goto err; goto err;
memcpy(buf, head, sizeof(head)); memcpy(buf, head, sizeof(head));
if (mysql_file_read(file, buf + sizeof(head), read_length= mysql_file_read(file, buf + sizeof(head),
frmlen - sizeof(head), MYF(MY_NABP))) frmlen - sizeof(head), MYF(MY_WME));
if (read_length == 0 || read_length == (size_t)-1)
{ {
share->error = my_errno == HA_ERR_FILE_TOO_SHORT share->error = OPEN_FRM_READ_ERROR;
? OPEN_FRM_CORRUPTED : OPEN_FRM_READ_ERROR;
my_free(buf); my_free(buf);
goto err; goto err;
} }
mysql_file_close(file, MYF(MY_WME)); mysql_file_close(file, MYF(MY_WME));
frmlen= read_length + sizeof(head);
share->init_from_binary_frm_image(thd, false, buf, frmlen); share->init_from_binary_frm_image(thd, false, buf, frmlen);
error_given= true; // init_from_binary_frm_image has already called my_error() error_given= true; // init_from_binary_frm_image has already called my_error()
my_free(buf); my_free(buf);
...@@ -759,17 +758,21 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -759,17 +758,21 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (*extra2 != '/') // old frm had '/' there if (*extra2 != '/') // old frm had '/' there
{ {
const uchar *e2end= extra2 + len; const uchar *e2end= extra2 + len;
while (extra2 < e2end) while (extra2 + 3 < e2end)
{ {
uchar type= *extra2++; uchar type= *extra2++;
size_t length= *extra2++; size_t length= *extra2++;
if (!length) if (!length)
{ {
if (extra2 + 258 >= e2end)
goto err;
length= uint2korr(extra2); length= uint2korr(extra2);
extra2+=2; extra2+=2;
if (length < 256) if (length < 256)
goto err; goto err;
} }
if (extra2 + length > e2end)
goto err;
switch (type) { switch (type) {
case EXTRA2_TABLEDEF_VERSION: case EXTRA2_TABLEDEF_VERSION:
if (tabledef_version.str) // see init_from_sql_statement_string() if (tabledef_version.str) // see init_from_sql_statement_string()
...@@ -780,12 +783,10 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -780,12 +783,10 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
} }
else else
{ {
uchar *buf= (uchar*) alloc_root(&mem_root, length);
if (!buf)
goto err;
memcpy(buf, extra2, length);
tabledef_version.str= buf;
tabledef_version.length= length; tabledef_version.length= length;
tabledef_version.str= (uchar*)memdup_root(&mem_root, extra2, length);
if (!tabledef_version.str)
goto err;
} }
break; break;
case EXTRA2_ENGINE_TABLEOPTS: case EXTRA2_ENGINE_TABLEOPTS:
...@@ -797,12 +798,12 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -797,12 +798,12 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
break; break;
default: default:
/* abort frm parsing if it's an unknown but important extra2 value */ /* abort frm parsing if it's an unknown but important extra2 value */
if (type >= 128) if (type >= EXTRA2_ENGINE_IMPORTANT)
goto err; goto err;
} }
extra2+= length; extra2+= length;
} }
if (extra2 > e2end) if (extra2 != e2end)
goto err; goto err;
} }
...@@ -2116,7 +2117,7 @@ ret: ...@@ -2116,7 +2117,7 @@ ret:
bool TABLE_SHARE::write_frm_image(const uchar *frm, size_t len) bool TABLE_SHARE::write_frm_image(const uchar *frm, size_t len)
{ {
return writefrm(normalized_path.str, db.str, table_name.str, 1, frm, len); return writefrm(normalized_path.str, db.str, table_name.str, false, frm, len);
} }
...@@ -3242,7 +3243,7 @@ rename_file_ext(const char * from,const char * to,const char * ext) ...@@ -3242,7 +3243,7 @@ rename_file_ext(const char * from,const char * to,const char * ext)
char from_b[FN_REFLEN],to_b[FN_REFLEN]; char from_b[FN_REFLEN],to_b[FN_REFLEN];
(void) strxmov(from_b,from,ext,NullS); (void) strxmov(from_b,from,ext,NullS);
(void) strxmov(to_b,to,ext,NullS); (void) strxmov(to_b,to,ext,NullS);
return (mysql_file_rename(key_file_frm, from_b, to_b, MYF(0))); return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0));
} }
......
...@@ -2539,12 +2539,6 @@ static inline int set_zone(int nr,int min_zone,int max_zone) ...@@ -2539,12 +2539,6 @@ static inline int set_zone(int nr,int min_zone,int max_zone)
return nr; 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;
......
...@@ -67,7 +67,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -67,7 +67,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
uint keys, KEY *key_info, handler *db_file) uint keys, KEY *key_info, handler *db_file)
{ {
LEX_STRING str_db_type; LEX_STRING str_db_type;
uint reclength, key_info_length, maxlength, tmp_len, i; uint reclength, key_info_length, tmp_len, i;
ulong key_buff_length; ulong key_buff_length;
ulong filepos, data_offset; ulong filepos, data_offset;
uint options_len; uint options_len;
...@@ -173,7 +173,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -173,7 +173,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
/* /*
If table comment is longer than TABLE_COMMENT_INLINE_MAXLEN bytes, If table comment is longer than TABLE_COMMENT_INLINE_MAXLEN bytes,
store the comment in an extra segment (up to TABLE_COMMENT_MAXLEN bytes). store the comment in an extra segment (up to TABLE_COMMENT_MAXLEN bytes).
Pre 6.0, the limit was 60 characters, with no extra segment-handling. Pre 5.5, the limit was 60 characters, with no extra segment-handling.
*/ */
if (create_info->comment.length > TABLE_COMMENT_INLINE_MAXLEN) if (create_info->comment.length > TABLE_COMMENT_INLINE_MAXLEN)
{ {
...@@ -212,7 +212,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -212,7 +212,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
frm.length+= extra2_size + 4; // mariadb extra2 frm segment frm.length+= extra2_size + 4; // mariadb extra2 frm segment
int2store(fileinfo+4, extra2_size); int2store(fileinfo+4, extra2_size);
int2store(fileinfo+6, frm.length); int2store(fileinfo+6, frm.length); // Position to key information
frm.length+= key_buff_length; frm.length+= key_buff_length;
frm.length+= reclength; // row with default values frm.length+= reclength; // row with default values
frm.length+= create_info->extra_size; frm.length+= create_info->extra_size;
...@@ -228,7 +228,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -228,7 +228,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
/* write the extra2 segment */ /* write the extra2 segment */
pos = frm_ptr + 64; pos = frm_ptr + 64;
*pos++ = EXTRA2_TABLEDEF_VERSION; compile_time_assert(EXTRA2_TABLEDEF_VERSION != '/');
*pos++ = EXTRA2_TABLEDEF_VERSION; // old servers write '/' here
*pos++ = create_info->tabledef_version.length; *pos++ = create_info->tabledef_version.length;
memcpy(pos, create_info->tabledef_version.str, memcpy(pos, create_info->tabledef_version.str,
create_info->tabledef_version.length); create_info->tabledef_version.length);
...@@ -241,7 +242,11 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -241,7 +242,11 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
*pos++= options_len; *pos++= options_len;
else else
{ {
DBUG_ASSERT(options_len <= 65535); // FIXME if necessary /*
At the moment we support options_len up to 64K.
We can easily extend it in the future, if the need arises.
*/
DBUG_ASSERT(options_len <= 65535);
int2store(pos + 1, options_len); int2store(pos + 1, options_len);
pos+= 3; pos+= 3;
} }
...@@ -255,9 +260,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -255,9 +260,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
DBUG_ASSERT(pos == frm_ptr + uint2korr(fileinfo+6)); DBUG_ASSERT(pos == frm_ptr + uint2korr(fileinfo+6));
key_info_length= pack_keys(pos, keys, key_info, data_offset); key_info_length= pack_keys(pos, keys, key_info, data_offset);
maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000)); int2store(forminfo+2, frm.length - filepos);
int2store(forminfo+2,maxlength); int4store(fileinfo+10, frm.length);
int4store(fileinfo+10,(ulong) (filepos+maxlength));
fileinfo[26]= (uchar) test((create_info->max_rows == 1) && fileinfo[26]= (uchar) test((create_info->max_rows == 1) &&
(create_info->min_rows == 1) && (keys == 0)); (create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length); int2store(fileinfo+28,key_info_length);
...@@ -312,7 +316,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -312,7 +316,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
pos+= key_info[i].parser_name->length + 1; pos+= key_info[i].parser_name->length + 1;
} }
} }
if (forminfo[46] == (uchar)255) if (forminfo[46] == (uchar)255) // New style MySQL 5.5 table comment
{ {
int2store(pos, create_info->comment.length); int2store(pos, create_info->comment.length);
pos+=2; pos+=2;
...@@ -378,7 +382,7 @@ int rea_create_table(THD *thd, LEX_CUSTRING *frm, ...@@ -378,7 +382,7 @@ int rea_create_table(THD *thd, LEX_CUSTRING *frm,
{ {
// TODO don't write frm for temp tables // TODO don't write frm for temp tables
if (create_info->tmp_table() && if (create_info->tmp_table() &&
writefrm(path, db, table_name, 0, frm->str, frm->length)) writefrm(path, db, table_name, true, frm->str, frm->length))
goto err_handler; goto err_handler;
if (thd->variables.keep_files_on_create) if (thd->variables.keep_files_on_create)
...@@ -393,7 +397,7 @@ int rea_create_table(THD *thd, LEX_CUSTRING *frm, ...@@ -393,7 +397,7 @@ int rea_create_table(THD *thd, LEX_CUSTRING *frm,
} }
else else
{ {
if (writefrm(path, db, table_name, 1, frm->str, frm->length)) if (writefrm(path, db, table_name, false, frm->str, frm->length))
goto err_handler; goto err_handler;
} }
...@@ -524,19 +528,18 @@ static bool pack_header(uchar *forminfo, List<Create_field> &create_fields, ...@@ -524,19 +528,18 @@ static bool pack_header(uchar *forminfo, List<Create_field> &create_fields,
COLUMN_COMMENT_MAXLEN); COLUMN_COMMENT_MAXLEN);
if (tmp_len < field->comment.length) if (tmp_len < field->comment.length)
{ {
if ((current_thd->variables.sql_mode & myf myf_warning= ME_JUST_WARNING;
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) ulonglong sql_mode= current_thd->variables.sql_mode;
{
my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name, if (sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))
static_cast<ulong>(COLUMN_COMMENT_MAXLEN)); myf_warning= 0;
my_error(ER_TOO_LONG_FIELD_COMMENT, myf_warning, field->field_name,
COLUMN_COMMENT_MAXLEN);
if (!myf_warning)
DBUG_RETURN(1); DBUG_RETURN(1);
}
char warn_buff[MYSQL_ERRMSG_SIZE];
my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_FIELD_COMMENT),
field->field_name,
static_cast<ulong>(COLUMN_COMMENT_MAXLEN));
push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_FIELD_COMMENT, warn_buff);
field->comment.length= tmp_len; field->comment.length= tmp_len;
} }
if (field->vcol_info) if (field->vcol_info)
...@@ -562,7 +565,7 @@ static bool pack_header(uchar *forminfo, List<Create_field> &create_fields, ...@@ -562,7 +565,7 @@ static bool pack_header(uchar *forminfo, List<Create_field> &create_fields,
expressions saved in the frm file for virtual columns. expressions saved in the frm file for virtual columns.
*/ */
vcol_info_length+= field->vcol_info->expr_str.length+ vcol_info_length+= field->vcol_info->expr_str.length+
FRM_VCOL_HEADER_SIZE(field->interval!=NULL); FRM_VCOL_HEADER_SIZE(field->interval);
} }
totlength+= field->length; totlength+= field->length;
...@@ -890,10 +893,10 @@ static bool pack_fields(uchar *buff, List<Create_field> &create_fields, ...@@ -890,10 +893,10 @@ static bool pack_fields(uchar *buff, List<Create_field> &create_fields,
*/ */
if (field->vcol_info && field->vcol_info->expr_str.length) if (field->vcol_info && field->vcol_info->expr_str.length)
{ {
*buff++= (uchar)(1 + test(field->interval_id)); *buff++= (uchar)(1 + test(field->interval));
*buff++= (uchar) field->sql_type; *buff++= (uchar) field->sql_type;
*buff++= (uchar) field->stored_in_db; *buff++= (uchar) field->stored_in_db;
if (field->interval_id) if (field->interval)
*buff++= (uchar) field->interval_id; *buff++= (uchar) field->interval_id;
memcpy(buff, field->vcol_info->expr_str.str, field->vcol_info->expr_str.length); memcpy(buff, field->vcol_info->expr_str.str, field->vcol_info->expr_str.length);
buff+= field->vcol_info->expr_str.length; buff+= field->vcol_info->expr_str.length;
......
...@@ -175,11 +175,15 @@ ...@@ -175,11 +175,15 @@
binary value of the 'length' bytes. binary value of the 'length' bytes.
Older MariaDB servers can ignore values of unknown types if Older MariaDB servers can ignore values of unknown types if
the type code is less than 128. Otherwise older servers are required the type code is less than 128 (EXTRA2_ENGINE_IMPORTANT).
Otherwise older (but newer than 10.0.1) servers are required
to report an error. to report an error.
*/ */
enum extra2_frm_value_type { enum extra2_frm_value_type {
EXTRA2_TABLEDEF_VERSION=0, EXTRA2_TABLEDEF_VERSION=0,
#define EXTRA2_ENGINE_IMPORTANT 128
EXTRA2_ENGINE_TABLEOPTS=128, EXTRA2_ENGINE_TABLEOPTS=128,
}; };
......
...@@ -3622,9 +3622,10 @@ int ha_federatedx::discover_assisted(handlerton *hton, THD* thd, ...@@ -3622,9 +3622,10 @@ int ha_federatedx::discover_assisted(handlerton *hton, THD* thd,
goto err2; goto err2;
query.copy(rdata[1], rlen[1], cs); query.copy(rdata[1], rlen[1], cs);
query.append(STRING_WITH_LEN(" CONNECTION=\""), cs); query.append(STRING_WITH_LEN(" CONNECTION='"), cs);
query.append(table_s->connect_string.str, table_s->connect_string.length, cs); query.append_for_single_quote(table_s->connect_string.str,
query.append('"'); table_s->connect_string.length);
query.append('\'');
error= table_s->init_from_sql_statement_string(thd, true, error= table_s->init_from_sql_statement_string(thd, true,
query.ptr(), query.length()); query.ptr(), query.length());
......
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