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

Function check_db_dir_existence

sql/sql_db.cc:2125–2152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2123
2124
2125bool check_db_dir_existence(const char *db_name)
2126{
2127 char db_dir_path[FN_REFLEN + 1];
2128 uint db_dir_path_len;
2129
2130 if (dbname_cache->contains(db_name))
2131 return 0;
2132
2133 db_dir_path_len= build_table_filename(db_dir_path, sizeof(db_dir_path) - 1,
2134 db_name, "", "", 0);
2135
2136 if (db_dir_path_len && db_dir_path[db_dir_path_len - 1] == FN_LIBCHAR)
2137 db_dir_path[db_dir_path_len - 1]= 0;
2138
2139 /*
2140 Check access.
2141
2142 The locking is to prevent creating permanent stale
2143 entries for deleted databases, in case of
2144 race condition with my_rmdir.
2145 */
2146 mysql_rwlock_rdlock(&rmdir_lock);
2147 int ret= my_access(db_dir_path, F_OK);
2148 if (!ret)
2149 dbname_cache->insert(db_name);
2150 mysql_rwlock_unlock(&rmdir_lock);
2151 return ret;
2152}

Callers 7

mysqld_show_create_dbFunction · 0.85
try_resolve_in_schemaMethod · 0.85
mysql_change_dbFunction · 0.85
create_eventMethod · 0.85
update_eventMethod · 0.85
sp_create_routineMethod · 0.85
mysql_create_viewFunction · 0.85

Calls 4

build_table_filenameFunction · 0.85
my_accessFunction · 0.85
containsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected