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

Function log_drop_table

sql/sql_table.cc:2075–2122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2073*/
2074
2075bool log_drop_table(THD *thd, const LEX_CSTRING *db_name,
2076 const LEX_CSTRING *table_name,
2077 const LEX_CSTRING *handler_name,
2078 bool partitioned,
2079 const LEX_CUSTRING *id,
2080 bool temporary_table)
2081{
2082 char buff[NAME_LEN*2 + 80];
2083 String query(buff, sizeof(buff), system_charset_info);
2084 bool error= 0;
2085 DBUG_ENTER("log_drop_table");
2086
2087 if (mysql_bin_log.is_open())
2088 {
2089 query.length(0);
2090 query.append(STRING_WITH_LEN("DROP "));
2091 if (temporary_table)
2092 query.append(STRING_WITH_LEN("TEMPORARY "));
2093 query.append(STRING_WITH_LEN("TABLE IF EXISTS "));
2094 append_identifier(thd, &query, db_name);
2095 query.append('.');
2096 append_identifier(thd, &query, table_name);
2097 query.append(STRING_WITH_LEN("/* Generated to handle "
2098 "failed CREATE OR REPLACE */"));
2099
2100 /*
2101 In case of temporary tables we don't have to log the database name
2102 in the binary log. We log this for non temporary tables, as the slave
2103 may use a filter to ignore queries for a specific database.
2104 */
2105 error= thd->binlog_query(THD::STMT_QUERY_TYPE,
2106 query.ptr(), query.length(),
2107 FALSE, FALSE, temporary_table, 0) > 0;
2108 }
2109 if (!temporary_table)
2110 {
2111 backup_log_info ddl_log;
2112 bzero(&ddl_log, sizeof(ddl_log));
2113 ddl_log.query= { C_STRING_WITH_LEN("DROP_AFTER_CREATE") };
2114 ddl_log.org_storage_engine_name= *handler_name;
2115 ddl_log.org_partitioned= partitioned;
2116 ddl_log.org_database= *db_name;
2117 ddl_log.org_table= *table_name;
2118 ddl_log.org_table_id= *id;
2119 backup_log_ddl(&ddl_log);
2120 }
2121 DBUG_RETURN(error);
2122}
2123
2124
2125int get_hlindex_keys_by_open(THD *thd, const LEX_CSTRING *db,

Callers 3

prepareMethod · 0.85
abort_result_setMethod · 0.85
mysql_create_like_tableFunction · 0.85

Calls 7

backup_log_ddlFunction · 0.85
binlog_queryMethod · 0.80
append_identifierFunction · 0.70
is_openMethod · 0.45
lengthMethod · 0.45
appendMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected