I am more used to SQL Server and I'd like to know if in MySql I can find something analog to SqlBulkCopy. I have a data editor written in WPF/Silverlight and C# using Connector/NET to connect to a MySql server, and I should provide a function inside the editor to make a full backup of some MySql databases. I have no direct access to the server so I cannot use dump or other command-line tools.
What would then the best way of dumping a whole database using only C# code via Connector? I just have to massively export data into XML, CSV or the like with my own SQL queries, or is there any suggested way for such tasks?
解决方案
SELECT INTO OUTFILE is the standard way to do this, but it can only dump data to the server's local file system. If you don't have access to the server, you won't be able to access the dump files.
I'd suggest a combination of
SHOW CREATE TABLE XXXX to retrieve the table sql, and some form of SELECT * FROM XXXX to retrieve the data. The Maatkit tools might be useful as reference. You could figure out what it's doing and copy the SQL: