Writing/Reading boolean field in XML
Posted: Tue 18 Nov 2014 10:00
Hi,
I'm using the method "SaveToXML" in TMyQuery and the XML is created correctly. I have a table with a boolean field, so in the XML is generated as "yes" or "no", like:
<xml>
...
NameField="yes"
...
The problem is that at a later time, I'm loading the XML into a table via MySQL, using a SQL query as:
"LOAD XML LOCAL INFILE 'my_xml.xml' INTO TABLE MyTable...."
And it seems that the Boolean values are not loaded correctly. It seems that the above query requires in the XML the boolean fields as "1" or "0" (not "True" or "False"). If I manually change in the XML the strings "True" by "1" (and "False" by "0"), the boolean values are loaded correctly into the table.
Am I missing something or an extra parameter to set?
Thanks!
I'm using the method "SaveToXML" in TMyQuery and the XML is created correctly. I have a table with a boolean field, so in the XML is generated as "yes" or "no", like:
<xml>
...
NameField="yes"
...
The problem is that at a later time, I'm loading the XML into a table via MySQL, using a SQL query as:
"LOAD XML LOCAL INFILE 'my_xml.xml' INTO TABLE MyTable...."
And it seems that the Boolean values are not loaded correctly. It seems that the above query requires in the XML the boolean fields as "1" or "0" (not "True" or "False"). If I manually change in the XML the strings "True" by "1" (and "False" by "0"), the boolean values are loaded correctly into the table.
Am I missing something or an extra parameter to set?
Thanks!