@Override
public int execute(PostgresQueryContext context, QueryBindings bindings, int maxrows) throws IOException {
context.initStore(schema);
PostgresServerSession server = context.getServer();
Session session = server.getSession();
ExternalDataService externalData = server.getExternalDataService();
InputStream istr;
long nrows = 0;
if (fromFile != null)
istr = new FileInputStream(fromFile);
else
// Always use a stream: we align records and messages, but
// this is not a requirement on the client.
istr = new PostgresCopyInputStream(server.getMessenger(),
toColumns.size());
try {
preExecute(context, DXLFunction.UNSPECIFIED_DML_WRITE);
switch (format) {
case CSV:
nrows = externalData.loadTableFromCsv(session, istr, csvFormat, skipRows,
toTable, toColumns,
commitFrequency, maxRetries,
context);
break;
case MYSQL_DUMP:
nrows = externalData.loadTableFromMysqlDump(session, istr, encoding,
toTable, toColumns,
commitFrequency, maxRetries,
context);
break;
}