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

Method read_xml

sql/sql_load.cc:2002–2198  ·  view source on GitHub ↗

Read a record in xml format tags and attributes are stored in taglist when tag set in ROWS IDENTIFIED BY is closed, we are ready and return */

Source from the content-addressed store, hash-verified

2000 when tag set in ROWS IDENTIFIED BY is closed, we are ready and return
2001*/
2002int READ_INFO::read_xml(THD *thd)
2003{
2004 DBUG_ENTER("READ_INFO::read_xml");
2005 int chr, chr2, chr3;
2006 int delim= 0;
2007 String tag, attribute, value;
2008 bool in_tag= false;
2009
2010 tag.length(0);
2011 attribute.length(0);
2012 value.length(0);
2013
2014 for (chr= my_tospace(GET); chr != my_b_EOF ; )
2015 {
2016 switch(chr){
2017 case '<': /* read tag */
2018 /* TODO: check if this is a comment <!-- comment --> */
2019 chr= my_tospace(GET);
2020 if(chr == '!')
2021 {
2022 chr2= GET;
2023 chr3= GET;
2024
2025 if(chr2 == '-' && chr3 == '-')
2026 {
2027 chr2= 0;
2028 chr3= 0;
2029 chr= my_tospace(GET);
2030
2031 while(chr != '>' || chr2 != '-' || chr3 != '-')
2032 {
2033 if(chr == '-')
2034 {
2035 chr3= chr2;
2036 chr2= chr;
2037 }
2038 else if (chr2 == '-')
2039 {
2040 chr2= 0;
2041 chr3= 0;
2042 }
2043 chr= my_tospace(GET);
2044 if (chr == my_b_EOF)
2045 goto found_eof;
2046 }
2047 break;
2048 }
2049 }
2050
2051 tag.length(0);
2052 while(chr != '>' && chr != ' ' && chr != '/' && chr != my_b_EOF)
2053 {
2054 if(chr != delim) /* fix for the '<field name =' format */
2055 tag.append(chr);
2056 chr= my_tospace(GET);
2057 }
2058
2059 // row tag should be in ROWS IDENTIFIED BY '<row>' - stored in line_term

Callers 1

read_xml_fieldFunction · 0.80

Calls 6

my_tospaceFunction · 0.85
lengthMethod · 0.45
appendMethod · 0.45
ptrMethod · 0.45
c_ptr_safeMethod · 0.45
push_frontMethod · 0.45

Tested by

no test coverage detected