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

Function parse_table_name

storage/sequence/sequence.cc:286–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284
285
286static bool parse_table_name(const char *name, size_t name_length,
287 ulonglong *from, ulonglong *to, ulonglong *step)
288{
289 uint n0=0, n1= 0, n2= 0;
290 *step= 1;
291
292 // the table is discovered if its name matches the pattern of seq_1_to_10 or
293 // seq_1_to_10_step_3
294 sscanf(name, "seq_%llu_to_%n%llu%n_step_%llu%n",
295 from, &n0, to, &n1, step, &n2);
296 // I consider this a bug in sscanf() - when an unsigned number
297 // is requested, -5 should *not* be accepted. But is is :(
298 // hence the additional check below:
299 return
300 n0 == 0 || !isdigit(name[4]) || !isdigit(name[n0]) || // reject negative numbers
301 (n1 != name_length && n2 != name_length);
302}
303
304
305Sequence_share *ha_seq::get_share()

Callers 5

get_shareMethod · 0.85
discover_tableFunction · 0.85
discover_table_existenceFunction · 0.85
drop_tableFunction · 0.85
prepare_create_tableMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected