MCPcopy Create free account
hub / github.com/MariaDB/server / update_frm_version

Function update_frm_version

sql/handler.cc:5496–5535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5494
5495
5496static bool update_frm_version(TABLE *table)
5497{
5498 char path[FN_REFLEN];
5499 File file;
5500 int result= 1;
5501 DBUG_ENTER("update_frm_version");
5502
5503 /*
5504 No need to update frm version in case table was created or checked
5505 by server with the same version. This also ensures that we do not
5506 update frm version for temporary tables as this code doesn't support
5507 temporary tables.
5508
5509 keep_original_mysql_version is set if the table version cannot be
5510 changed without rewriting the frm file.
5511 */
5512 if (table->s->mysql_version == MYSQL_VERSION_ID ||
5513 table->s->keep_original_mysql_version)
5514 DBUG_RETURN(0);
5515
5516 strxmov(path, table->s->normalized_path.str, reg_ext, NullS);
5517
5518 if ((file= mysql_file_open(key_file_frm,
5519 path, O_RDWR|O_BINARY, MYF(MY_WME))) >= 0)
5520 {
5521 uchar version[4];
5522
5523 int4store(version, MYSQL_VERSION_ID);
5524
5525 if ((result= (int)mysql_file_pwrite(file, (uchar*) version, 4, 51L,
5526 MYF(MY_WME+MY_NABP))))
5527 goto err;
5528
5529 table->s->mysql_version= MYSQL_VERSION_ID;
5530 }
5531err:
5532 if (file >= 0)
5533 (void) mysql_file_close(file, MYF(MY_WME));
5534 DBUG_RETURN(result);
5535}
5536
5537
5538/**

Callers 2

ha_checkMethod · 0.85
ha_repairMethod · 0.85

Calls 2

strxmovFunction · 0.85
int4storeFunction · 0.85

Tested by

no test coverage detected