private String getLoadDataSql (String tableName, String allColumns, ResultSetMetaData rsmd) throws SQLException {
      StringBuilder loadDataSql = new StringBuilder();
      loadDataSql.append("LOAD DATA LOCAL INFILE 'dummy' INTO TABLE ");
      loadDataSql.append(tableName);
      loadDataSql.append(" CHARACTER SET UTF8 FIELDS TERMINATED BY X'1F' ");

      // loop through the columns, if it is a BLOB type, convert it into a variable
      if (allColumns != null) {
         loadDataSql.append(" (");
         String[] columns = allColumns.split(",");
         for (int i = 0; i < columns.length; i++) {
            switch (rsmd.getColumnType(i + 1)) {
               case Types.BIT:
               case Types.BINARY:
               case Types.BLOB:
               case Types.VARBINARY:
               case Types.LONGVARBINARY:
                  loadDataSql.append("@").append(columns[i]).append(", ");
                  break;
               default:
                  loadDataSql.append(columns[i]).append(", ");
                  break;
            }
         }
         // remove two last chars
         loadDataSql.setLength(loadDataSql.length() - 2);
         loadDataSql.append(")");

         // SET variables with UNHEX
         String setPrefix = " SET ";
         for (int i = 0; i < columns.length; i++) {
            switch (rsmd.getColumnType(i + 1)) {
               case Types.BIT:
               case Types.BINARY:
               case Types.BLOB:
               case Types.VARBINARY:
               case Types.LONGVARBINARY:
                  loadDataSql.append(setPrefix).append(columns[i]).append("=UNHEX(@").append(columns[i]).append(") ");
                  loadDataSql.append(", ");
                  setPrefix = "";
                  break;
               default:
                  break;
            }
         }
         // remove two last chars
         if (setPrefix.equals("")) loadDataSql.setLength(loadDataSql.length() - 2);
      }

      LOG.info("Loading data with this command: {}", loadDataSql);
      return loadDataSql.toString();
   }
Constructs the SqlManager.

@param opts the ReplicaDB ToolOptions describing the user's requested action.
src/main/java/org/replicadb/manager/MySQLManager.java