MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_xpath_parse_Number

Function my_xpath_parse_Number

sql/item_xmlfunc.cc:2361–2377  ·  view source on GitHub ↗

Scan Number SYNOPSYS [30] Number ::= Digits ('.' Digits?)? | '.' Digits) or in other words: [30] Number ::= Digits | Digits '.' | Digits '.' Digits | '.' Digits Note: the last rule is not supported yet, as it is in conflict with abbreviated step. 1 + .123 does not work, 1 + 0.123 does. Perhaps it is better

Source from the content-addressed store, hash-verified

2359 0 - failure
2360*/
2361static int my_xpath_parse_Number(MY_XPATH *xpath)
2362{
2363 const char *beg;
2364 if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS))
2365 return 0;
2366 beg= xpath->prevtok.beg;
2367 if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
2368 {
2369 xpath->item= new Item_int(xpath->prevtok.beg,
2370 xpath->prevtok.end - xpath->prevtok.beg);
2371 return 1;
2372 }
2373 my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS);
2374
2375 xpath->item= new Item_float(beg, xpath->prevtok.end - beg);
2376 return 1;
2377}
2378
2379
2380/*

Callers 1

Calls 1

my_xpath_parse_termFunction · 0.85

Tested by

no test coverage detected