Page 1 of 1

Writing/Reading boolean field in XML

Posted: Tue 18 Nov 2014 10:00
by rahucha
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!

Re: Writing/Reading boolean field in XML

Posted: Tue 18 Nov 2014 14:03
by ViktorV
To solve the problem, please set the TMyQuery.Options.EnableBoolean property to False before calling the TMyQuery.SaveToXML method.
You can find more details in the MyDAC help: http://www.devart.com/mydac/docs/index. ... oolean.htm

Re: Writing/Reading boolean field in XML

Posted: Thu 20 Nov 2014 10:45
by rahucha
Thanks a lot! Really appreciated!

Re: Writing/Reading boolean field in XML

Posted: Fri 21 Nov 2014 09:21
by ViktorV
It is good to see that the problem has been solved. Feel free to contact us if you have any further questions.