| 183 | */ |
| 184 | |
| 185 | uint explain_filename(THD* thd, |
| 186 | const char *from, |
| 187 | char *to, |
| 188 | uint to_length, |
| 189 | enum_explain_filename_mode explain_mode) |
| 190 | { |
| 191 | char *to_p= to; |
| 192 | char *end_p= to_p + to_length; |
| 193 | const char *db_name= NULL; |
| 194 | int db_name_len= 0; |
| 195 | const char *table_name; |
| 196 | int table_name_len= 0; |
| 197 | const char *part_name= NULL; |
| 198 | int part_name_len= 0; |
| 199 | const char *subpart_name= NULL; |
| 200 | int subpart_name_len= 0; |
| 201 | enum enum_part_name_type {NORMAL, TEMP, RENAMED} part_type= NORMAL; |
| 202 | |
| 203 | const char *tmp_p; |
| 204 | DBUG_ENTER("explain_filename"); |
| 205 | DBUG_PRINT("enter", ("from '%s'", from)); |
| 206 | tmp_p= from; |
| 207 | table_name= from; |
| 208 | /* |
| 209 | If '/' then take last directory part as database. |
| 210 | '/' is the directory separator, not FN_LIB_CHAR |
| 211 | */ |
| 212 | while ((tmp_p= strchr(tmp_p, '/'))) |
| 213 | { |
| 214 | db_name= table_name; |
| 215 | /* calculate the length */ |
| 216 | db_name_len= tmp_p - db_name; |
| 217 | tmp_p++; |
| 218 | table_name= tmp_p; |
| 219 | } |
| 220 | tmp_p= table_name; |
| 221 | /* Look if there are partition tokens in the table name. */ |
| 222 | while ((tmp_p= strchr(tmp_p, '#'))) |
| 223 | { |
| 224 | tmp_p++; |
| 225 | switch (tmp_p[0]) { |
| 226 | case 'P': |
| 227 | case 'p': |
| 228 | if (tmp_p[1] == '#') |
| 229 | { |
| 230 | part_name= tmp_p + 2; |
| 231 | tmp_p+= 2; |
| 232 | } |
| 233 | break; |
| 234 | case 'S': |
| 235 | case 's': |
| 236 | if ((tmp_p[1] == 'P' || tmp_p[1] == 'p') && tmp_p[2] == '#') |
| 237 | { |
| 238 | part_name_len= tmp_p - part_name - 1; |
| 239 | subpart_name= tmp_p + 3; |
| 240 | tmp_p+= 3; |
| 241 | } |
| 242 | break; |
nothing calls this directly
no test coverage detected