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

Function explain_filename

sql/sql_table.cc:260–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258*/
259
260uint explain_filename(THD* thd,
261 const char *from,
262 char *to,
263 uint to_length,
264 enum_explain_filename_mode explain_mode)
265{
266 char *to_p= to;
267 char *end_p= to_p + to_length;
268 const char *db_name= NULL;
269 size_t db_name_len= 0;
270 const char *table_name;
271 size_t table_name_len= 0;
272 const char *part_name= NULL;
273 size_t part_name_len= 0;
274 const char *subpart_name= NULL;
275 size_t subpart_name_len= 0;
276 uint part_type= NORMAL_PART_NAME;
277
278 const char *tmp_p;
279 DBUG_ENTER("explain_filename");
280 DBUG_PRINT("enter", ("from '%s'", from));
281 tmp_p= from;
282 table_name= from;
283 /*
284 If '/' then take last directory part as database.
285 '/' is the directory separator, not FN_LIB_CHAR
286 */
287 while ((tmp_p= strchr(tmp_p, '/')))
288 {
289 db_name= table_name;
290 /* calculate the length */
291 db_name_len= (int)(tmp_p - db_name);
292 tmp_p++;
293 table_name= tmp_p;
294 }
295 tmp_p= table_name;
296 /* Look if there are partition tokens in the table name. */
297 while ((tmp_p= strchr(tmp_p, '#')))
298 {
299 tmp_p++;
300 switch (tmp_p[0]) {
301 case 'P':
302 case 'p':
303 if (tmp_p[1] == '#')
304 {
305 part_name= tmp_p + 2;
306 tmp_p+= 2;
307 }
308 break;
309 case 'S':
310 case 's':
311 if ((tmp_p[1] == 'P' || tmp_p[1] == 'p') && tmp_p[2] == '#')
312 {
313 part_name_len= (int)(tmp_p - part_name - 1);
314 subpart_name= tmp_p + 3;
315 tmp_p+= 3;
316 }
317 break;

Callers 2

test_1Function · 0.85

Calls 2

strnmovFunction · 0.85
add_identifierFunction · 0.85

Tested by 1

test_1Function · 0.68