Class ExportTable

java.lang.Object
edu.wisc.game.tools.ExportTable

public class ExportTable
extends Object
This is a substitute for something like this:
select * into outfile '/var/lib/mysql-files/tmp-PlayerInfo.csv'   FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'   LINES TERMINATED BY '\n'   FROM game.PlayerInfo;
It is to be used on machines where the MySQL server is not set up with permissions to write to any directory (i.e. @@secure_file_priv is NULL).

Unlike most of other database-connecting tools, this class uses the plain JDBC Connection, rather than JPA. This is done so that we can sent over plain SQL commands, such as "SELECT * FROM ...", and to access the ResultSet's metadata, finding out the names of the columns in the result. The point of this exercise is to be able to print the table header (column names) into the output CSV file.