views:

36

answers:

1

Hi all,
I'm a noob at C++ and MySQL and I only want to retreive a xml file stored as a longblob in MySQL. I did a SELECT query to get the content and after I store this content in a xml file with std::ofstream. With this i get:

<?xml version="1.0" encoding="UTF-16"?> <AnObject noNamespaceSchemaLocation...

instead of this:

<?xml version="1.0" encoding="UTF-16"?>
<AnObject noNamespaceSchemaLocation...

So I'm missing the end of line (I think \n). I'm not sure that writing the result of a query to a xml file is the proper way of doing it, is there an other way? Maby it could solve my problem.

Thank you so much!

A: 

You question is similar to this question:

And the highest ranked answer says you need to use a VARCHAR (or a TEXT) data type.

However, this question discusses the best practices of storing XML in a database, and it recommends storing XML outside the database. (And if you have SQL Server, FILESTREAM is full-text searchable.)

JohnB
thanks for the info John!
Nick